user51854
user51854

Reputation: 319

Unique device identification for ios

I have a HTML/JS/CSS app which I wish to convert to an ios app using phonegap. In my application, I require to identify each device uniquely. From iOS 7 Apple does not accept app that Fetch UDID. I want to achieve this for ios4+ to latest. I have seen one plugin listed at https://build.phonegap.com/plugins/1112. One additional question related to this plugin is if I use a plugin which relies on keychain then what is the risk factor, i.e., under which circumstances is the keychain reset or cleared?

Upvotes: 1

Views: 2825

Answers (4)

Niko
Niko

Reputation: 3422

According to Cordova documentation here's the way to get device UUID

var string = device.uuid;

Note that for iOS the UUID for a device is different from each app. This UUID is created on your app first run, and changes when you delete and re-install your app.

iOS Quirk

The uuid on iOS uses the identifierForVendor property. It is unique to the device across the same vendor, but will be different for different vendors and will change if all apps from the vendor are deleted and then reinstalled. The UUID will be the same if app is restored from a backup or iCloud as it is saved in preferences. Users using older versions of this plugin will still receive the same previous UUID generated by another means as it will be retrieved from preferences.

Upvotes: 1

Vanger
Vanger

Reputation: 702

This is not common way but it may be helpful.

You can use service http://get.udid.io to get real UDID of device.

Here is repo with example of usage https://github.com/vladignatyev/udidio-example

Upvotes: 2

Alex
Alex

Reputation: 5278

Per swift, the latest way I've been doing this is:

var vendorDeviceId = UIDevice.currentDevice().identifierForVendor.UUIDString

This is correct, the UUID is now unique per app install, not device. If the user re-installs your app he will be assigned a new unique identifier (different from the last one).

Upvotes: 1

Related Questions