2

I'm aware if the following methods, each which has it'd flaws

  • UDID
  • Advertising Identifier
  • Vendor ID

The problem with UDID is that its deprecated and doesn't even work as of ios7, problem with other two is that the user can change them via software reset of phone or reinstallation of app

Another interesting solution I found is to randomly generate one yourself and then save to keychain to avoid deletion upon app reinstallation however would this work across software resets? And surely there's a very small chance that two devices would randomly generate the same ID?

I think the best option might be to use UDID but I would like to know if, even though the UDID is incorrect as of ios7, is it still unique?

Yet another option is MAC address but as far as I know, there is no API for these

Please advise on the best option

Hamzah Malik
  • 2,540
  • 3
  • 28
  • 46
  • 1
    According to this answer, there is an API for getting MAC address http://stackoverflow.com/a/677741/1796907 – egor.zhdan Sep 29 '15 at 15:13
  • @egor.zhdan Answers and comments suggest it doesn't work on ios7 and above, just like udid – Hamzah Malik Sep 29 '15 at 15:16
  • There are commercial vendors out there that use device fingerprinting to mostly uniquely identify devices. – Paul Cezanne Sep 29 '15 at 15:18
  • Is there a reason you don't want to have your users create an account when they first open the app? – Aabglov Sep 29 '15 at 15:18
  • @Aabglov that's what I'm doing. I'm planning to support the user having multiple devices on one account and because of the structure of my app, it requires devices to be uniquely identified – Hamzah Malik Sep 29 '15 at 15:19
  • UUID isn't allowed anymore, however, you can generate your own UUID and store it on the devices' UserDefaults. – StrawHara Sep 29 '15 at 15:21
  • @MrMojoRisin Aren't userdefaults wiped when app is deleted? – Hamzah Malik Sep 29 '15 at 15:21
  • @Malik Hmmmm... You're right :/ – StrawHara Sep 29 '15 at 15:22
  • Is there going to be any user control over the devices? If they login to their account can they choose the device they're currently using to overwrite a previously stored one? – Aabglov Sep 29 '15 at 15:29
  • The last way is to ask the device phone number and send a verification code like Snapchat... But you will have to justify; for the appstore validation. – StrawHara Sep 29 '15 at 15:30
  • @MrMojoRisin I am already doing this. However I need to identify the device that the user is using for purpose of managing the different devices the user has linked to their account. – Hamzah Malik Sep 29 '15 at 15:32

1 Answers1

0

Starting iOS 7 deducing MAC address isn't possible. You can, however, use below:

[[[UIDevice currentDevice] identifierForVendor] UUIDString]

Per Apple Documentation:

The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them. The value can also when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution. Therefore, if your app stores the value of this property anywhere, you should gracefully handle situations where the identifier changes.

Abhinav
  • 37,684
  • 43
  • 191
  • 309
  • Value changing kind of ruins the idea. I could store the value in keychain but then it'd sync to other devices so it wouldn't be unique – Hamzah Malik Sep 29 '15 at 15:51