由于 UDID 已被弃用,他们有任何替代 UDID 的方法吗?
问问题
2188 次
2 回答
1
You can use the following thing as a unique Identifier for your app user's :
I use the method below to create a UUID and save it to the user preferences the first time the app is started:
- (NSString *)getUUID
{
NSString *UUID = [[NSUserDefaults standardUserDefaults] objectForKey:@"uniqueID"];
if (!UUID)
{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
UUID = [(__bridge NSString*)string stringByReplacingOccurrencesOfString:@"-"withString:@""];
[[NSUserDefaults standardUserDefaults] setValue:UUID forKey:@"uniqueID"];
}
return UUID;
}
Hope that helps !
于 2013-04-10T04:40:40.017 回答
1
Apple 停止支持 iOS 的唯一标识符。这个源代码解决了这个问题。它根据设备的mac地址和bundle标识符生成一个唯一标识符。
于 2013-04-10T05:18:02.460 回答