How to Identify iOS Device Uniquely

How to identify iOS device uniquely instead of using UUID and UDID

Apple has done away with the approach of UDIDs and will reject apps that use the same for unique device identification.
Source: TNW

What you are looking for is Vendor ID

How can you uniquely identify an iOS device?

The closest thing we have to the uuid is the vendor id now

Best way to uniquely identify iOS device?

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.

Unique Identification of iOS device for iOS 7.0 and above

Since iOS 7 it is no longer possible to get any unique device identifiers.

Your options are:

  • create your own unique ID and save it in the keychain.
  • use the vendor ID, which will be reset if all the app by the same vendor are removed from the device.

How to get a unique device ID in Swift?

You can use this (Swift 3):

UIDevice.current.identifierForVendor!.uuidString

For older versions:

UIDevice.currentDevice().identifierForVendor

or if you want a string:

UIDevice.currentDevice().identifierForVendor!.UUIDString


There is no longer a way to uniquely identify a device after the user uninstalled the app(s). The documentation says:

The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them.


You may also want to read this article by Mattt Thompson for more details:

http://nshipster.com/uuid-udid-unique-identifier/

Update for Swift 4.1, you will need to use:

UIDevice.current.identifierForVendor?.uuidString


Related Topics



Leave a reply



Submit