你应该可以使用 [UIDevice identifierForVendor] 为了你的目的。根据文件:
[UIDevice identifierForVendor]
对于来自同一设备上运行的同一供应商的应用,此属性的值相同。
基于此,如果您删除并重新安装应用程序,我认为该值不应该更改。一些快速测试证实它在删除/安装周期中是持久的。
编辑:
看起来像 identifierForVendor 仅在iOS 7上通过删除/安装持久化,因此在iOS 6上使用uniqueIdentifier,在iOS 7上使用identifierForVendor:
identifierForVendor
@implementation UIDevice (persistentDeviceIdentifier) -(NSString*)persistentDeviceIdentifier { if([self respondsToSelector:@selector(uniqueIdentifier)]) return [self performSelector:@selector(uniqueIdentifier)]; else return [[self identifierForVendor] UUIDString]; } @end