iOS7 app backward compatible with iOS5 regarding unique identifier

后端 未结 3 772
天命终不由人
天命终不由人 2020-12-06 02:35

My app is compatible with iOS5 and iOS6. Until now I had no problem using:

NSString DeviceID = [[UIDevice currentDevice] uniqueIdentifier];

3条回答
  •  广开言路
    2020-12-06 02:42

    Why just not to use CFUUIDRef and be independent with iOS verion?

    CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);
    
    self.uuidString = (NSString *)CFUUIDCreateString(NULL,uuidRef);
    
    CFRelease(uuidRef);
    

    And of course remember calculated uuidString in the Keychain(in case of application removal)?

    Here is written how to use keychain

提交回复
热议问题