iOS 7 access UUID value in an enterprise application (not for AppStore)

守給你的承諾、 提交于 2019-12-05 20:48:54

You should be able to use [UIDevice identifierForVendor] for your purpose. According to the documentation:

The value of this property is the same for apps that come from the same vendor running on the same device.

Based on that I don't think the value should change if you delete and reinstall the application. Some quick testing confirms that it is persistent through delete/install cycles.

EDIT:

It looks like identifierForVendor is only persistent through remove/install on iOS 7, so use uniqueIdentifier on iOS 6 and identifierForVendor on iOS 7 as:

@implementation UIDevice (persistentDeviceIdentifier)

-(NSString*)persistentDeviceIdentifier
{
    if([self respondsToSelector:@selector(uniqueIdentifier)])
        return [self performSelector:@selector(uniqueIdentifier)];
    else
        return [[self identifierForVendor] UUIDString];
}

@end
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!