Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method [[UIDevice currentDevice] uniqueIdentifier] is not allowed any more, I need an alternative

I'm using [[UIDevice currentDevice] uniqueIdentifier] in all of my apps, Apple is not allowing the use of uniqueIdentifier anymore. I need something to use that replaces the uniqueIdentifier which I can use to recognize a user even when the user deletes the app and installs it again, (and also get my app approved by apple).

Thanks

like image 932
user784625 Avatar asked Feb 22 '12 13:02

user784625


1 Answers

The documentation recommends what to do in this section.

Special Considerations
Do not use the uniqueIdentifier property. To create a unique identifier specific to your app, you can call the CFUUIDCreate function to create a UUID, and write it to the defaults database using the NSUserDefaults class.

To make sure that the unique identifier remains after you delete the app you should store it in the keychain rather than NSUserDefaults. Using the keychain you will also be able to share the same unique ID across all of your apps on the same device using keychain access groups. This approach will prevent you from incorrectly tracking users after the device is no longer theirs, and it will be available on any new iDevice they restore from backup.

like image 110
Joe Avatar answered Oct 22 '22 07:10

Joe