iOS 7在不同的应用程序中显示不同的UDID [英] iOS 7 showing different UDIDs in different applications
问题描述
我正在使用此代码在我的应用中获取iOS 7设备的UDID
I am using this code to get the UDID of iOS 7 device in my app
+(NSString*)uniqueIDForDevice
{
NSString* uniqueIdentifier = nil;
if( [UIDevice instancesRespondToSelector:@selector(identifierForVendor)] )
{ // >=iOS 7
uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else
{ //<=iOS6, Use UDID of Device
CFUUIDRef uuid = CFUUIDCreate(NULL);
//uniqueIdentifier = ( NSString*)CFUUIDCreateString(NULL, uuid);- for non- ARC
uniqueIdentifier = ( NSString*)CFBridgingRelease(CFUUIDCreateString(NULL, uuid));// for ARC
CFRelease(uuid);
}
return uniqueIdentifier;
}
但其他应用程序中的相同代码显示另一个UDID。如何在整个iPad中获得唯一的标识符,无论应用程序如何?
But the same code in other applications shows another UDID. How can I get the unique identifier which will be the same throughout the iPad irrespective of the application?
推荐答案
你不能。
identifierForVendor
只会为该设备上的同一个开发者提供相同的应用标识符。它不能保证是永久性的;如果您从供应商中删除所有应用程序,然后重新安装它们,则可能会获得不同的标识符。
identifierForVendor
will only give you the same identifier for apps from the same developer on that device. And it's not guaranteed to be permanent; if you delete all the apps from the vendor, and then reinstall them, it's likely you'll get a different identifier.
至于您的iOS6实施,那不会给你任何永久性的东西,因为UUID的意思是每次都给你一个独特的字符串。
As for your iOS6 implementation, that's not going to give you anything permanent, as the point of a UUID is to give you a unique string every time.
这篇关于iOS 7在不同的应用程序中显示不同的UDID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!