Reputation: 1010
My cordova app uses device.uuid
after I installed the device
plugin, I still cannot use that property and my app hangs up on the line where I use device.uuid.
Upvotes: 1
Views: 1120
Reputation: 53301
On iOS 7 apple removed the uniqueIdentifier
, the device.uuid
is phonegap specific and it isn't using uniqueIdentifier
internally, so you can still use it.
To use device.uuid
on phonegap 3.X.X you have to add the device plugin first like this:
cordova plugin add org.apache.cordova.device
It works because I've just tested it (on cordova 3.5.0). If you installed the plugin and it was hanging your app maybe there was some bug with your phonegap version or the plugin wasn't installed correctly.
The problem with the device.uuid is that is isn't the real device uuid, from phonegap doc
iOS Quirk
The uuid on iOS is not unique to a device, but varies for each application, for each installation. It changes if you delete and re-install the app, and possibly also when you upgrade iOS, or even upgrade the app per version (apparent in iOS 5.1). The uuid is not a reliable value.
The device.uuid
isn't using identifierForVendor
either, it's just a random identifier persisted on the device, but if you want to get the real identifierForVendor
I've created a plugin to get it.
https://github.com/jcesarmobile/IDFVPlugin
Upvotes: 1
Reputation: 69469
Since iOS7 you can no longer use the device.uuid
Apple made impossible to track devices. You will have to use either the advertising id, vendor ID or create your own unique ID.
Just to add on this, from the developers site of PhoneGap
The uuid for iOS is not unique for a device, but is unique per application per install. This will change if you delete the app and re-install, and possibly also when you upgrade your iOS version, or even upgrade your app per version (as we've seen in iOS 5.1). Not a reliable value.
Looks like PhoneGap/Cordova is using identifierForVendor
which kan sometimes return nil and you will have to wait some time before calling it again. Apparently this is not implemented correctly in the cordova and causes the hang in your app.
Upvotes: 2