An alternative to the device UDID - preparing ourselves

16,072

Solution 1

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).

Solution 2

My personal favorite is OpenUDID.

You can grab the GitHub here.

I've summarized my thoughts and put a brief description of it here.

Solution 3

SecureUDID, based on OpenUDID but more secure, accessible by domain only (and salt)

More info.

Solution 4

One of a devices 2 or 3 MAC address is already exposed by the protocol specification during any wireless communication.

Share:
16,072
Stavash
Author by

Stavash

Updated on August 18, 2022

Comments

  • Stavash
    Stavash over 1 year

    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?

  • Stavash
    Stavash about 12 years
    They aren't the only ones to overcome this. I read about several other methods but the main problem is that now we are looking at a non-centralized solution that will be a huge pain in the a$% for us developers. Thanks for your response
  • Tuyen Nguyen
    Tuyen Nguyen about 12 years
    CFUUID will be different when users delete and reinstall your app.
  • lxt
    lxt about 12 years
    You can always save it into the keychain, rather than user defaults, in which case a plain delete/re-install wouldn't affect it. The only way to reasonably remove the keychain entries for an end-user is to do a full wipe of the device.
  • Nestor
    Nestor about 12 years
    But doesn't NSUserDefaults get restored to a new device when a backup is restored? In which case it's not a unique device identifier.
  • Nestor
    Nestor about 12 years
    Looking at the code, it just does the UUID in NSUserDefaults trick as described in another answer here.
  • Amit Battan
    Amit Battan almost 12 years
    How will push notification work without UDID
  • lxt
    lxt almost 12 years
    Push notifications don't use UDIDs - they use a device token that is generated by the device when the user opts into notifications. They can and do vary from app to app.
  • Chris Maddern
    Chris Maddern over 11 years
    @Nestor - I missed that. Pretty hand to have it in a lib though, especially if it becomes widely adopted and we get a standard device identifier again!
  • Alberto M
    Alberto M over 10 years
    can't use the mac address anymore
  • Sirio
    Sirio over 9 years
    OpenUDID is not restore-safe. If a user restore the device the OpenUDID changes. This make it not so useful, imho.
  • King-Wizard
    King-Wizard over 9 years
    Deprecated now see these links: github.com/ylechelle/OpenUDID and blog.appsfire.com/…