11

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?

Community
  • 1
  • 1
Stavash
  • 14,244
  • 5
  • 52
  • 80

5 Answers5

15

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

lxt
  • 31,146
  • 5
  • 78
  • 83
  • 4
    CFUUID will be different when users delete and reinstall your app. – Tuyen Nguyen Mar 26 '12 at 15:51
  • 2
    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. – lxt Mar 26 '12 at 17:41
  • 2
    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 Mar 28 '12 at 19:44
  • How will push notification work without UDID – Amit Battan Jul 24 '12 at 05:28
  • 2
    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. – lxt Jul 24 '12 at 11:56
9

My personal favorite is OpenUDID.

You can grab the GitHub here.

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

Jagat Dave
  • 1,643
  • 3
  • 23
  • 30
Chris Maddern
  • 737
  • 5
  • 12
  • Looking at the code, it just does the UUID in NSUserDefaults trick as described in another answer here. – Nestor Mar 28 '12 at 19:48
  • @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! – Chris Maddern Aug 06 '12 at 13:35
  • OpenUDID is not restore-safe. If a user restore the device the OpenUDID changes. This make it not so useful, imho. – Sirio Aug 06 '14 at 13:54
  • Deprecated now see these links: https://github.com/ylechelle/OpenUDID/ and http://blog.appsfire.com/udid-is-dead-openudid-is-deprecated-long-live-advertisingidentifier/ – King-Wizard Nov 30 '14 at 23:43
4

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

More info.

Jagat Dave
  • 1,643
  • 3
  • 23
  • 30
gomezo
  • 51
  • 1
1

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

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
0

While I think this is not a typical "how do I overcome this particular technical challenge" I agree it is wildly important and could be well discussed in SO somehow (not sure - wiki? Forum?). I'd be interested to know whether there are discussions in how Flurry beat this.

Scott Corscadden
  • 2,831
  • 1
  • 25
  • 43
  • 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 – Stavash Mar 25 '12 at 11:04