Search code examples
iosapp-storeudid

An alternative to the device UDID - preparing ourselves


Possible Duplicate:
UIDevice uniqueIdentifier Deprecated - What To Do Now?

I know there have been quite a few questions on SO about this, but I think that because Apple is moving ahead of schedule and actively denying applications that make use of UDIDs (http://pulse.me/s/7mzKE), us developers need to take an active approach and discuss this matter in bulk.

So the question is - what is a good, stable and correct alternative for unique device identification, other than accessing it's UDID property?


Solution

  • This depends on your needs...if you're looking for a simple device identifier for your application to use, then the documentation on the deprecated uniqueIdentifier method pretty much provides your answer:

    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.

    CFUUIDCreate will return a unique handset identifier that is unique to your application. You need to store it in NSUserDefaults because it will change if you make subsequent calls. For most uses this will suffice, and it's not as if Apple didn't provide enough warning of this change (iOS 5 has been out for over six months now, and the developer docs for longer).

    The other scenario is where you need to share your device identifier across applications (ie, mobile advertising networks). That's a more complex problem, with a number of alternative options (there's also no guarantee they'll remain around in the future: Apple's primary reason for deprecating the UDID API is presumably to stop cross application user tracking).