identifierForVendor changes on reinstall - ios

identifierForVendor is not supposed to change on reinstall of app:
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. The value can
also change 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.
https://developer.apple.com/reference/uikit/uidevice/1620059-identifierforvendor
However, I've just tested this with one of our live apps on the app store. Even with a number of other of our apps still installed on the device, if I reinstall app A the UUID returned from identifierForVendor changes every time.
It was not like this.
This used to work. But at some point, the UUID seems to have started changing on "simple reinstalls" (as stated above). Is this a known bug? Is identifierForVendor known to be broken versus the documentation above? Any workarounds (other than saving UUID to keychain, because that method breaks with iCloud syncing)?

It's a known bug. It seems like Apple made an update to AppStore that causes this new behavior for identifierForVendor around the 28:th May. If you search in the App Developer forum, there are other developers reporting the same problem.
The signature gc from Apple have replied on the issue with the following answer:
"Please file bug reports on this at https://developer.apple.com/bug-reporting>. We're aware of this issue and are investigating. There's no known workaround at this time."

identifierForVendor is expected to change when all vendor's apps are removed from the device. Also, it is bound to change if you're building and installing from Xcode directly.
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. The value can also change 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.
Source: UIKit/UIDevice/identifierForVendor

We are about to resubmit using an App Group entitlement to give us shared NSUserDefaults. It sounds like App Group NSUserDefaults (unlike keychain-access-group and iCloud key-value storage entitlements) are shared on the device, but not over the iCloud account. If the shared "deviceid" NSUserDefault key doesn't exist, we'll save the IdentifierForVendor ID and then use that for all our apps once it saved.

Related

Apple UUID while updating whole project with same bundle ID

I have an application written in mixed Obj-C/Swift, it uses UUID for identification of a device. I am rewriting whole application in Swift, using another project with same bundle ID. However when I try to update old project build with Xcode using new one build with Xcode too, new application UUID is different. What I am missing? Shouldn't it be the same because I am using same bundle ID?
Does UUID mean UIDevice.current.identifierForVendor?.uuidString ?
If so, it changes in some situations documented in Apple developer page.
https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor
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. The value can also change 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.
My bad, it indeed stays the same, old application was saving one in keychain and using it even after reinstall.

Vendor ID changes with app re-installation with iOS 11 GM

I've just noticed that the vendor id is changing whenever the app in uninstalled and re-installed with iOS 11, but does not with iOS 10.
I can't find any reference to this being intentional behavior from Apple, but as this is occurring in the Gold Master of iOS 11 presumably it can't be a bug at this very late stage.
Anybody have any info of this?
[P.S. Yes I know it can be stored in the keychain]
This is expected behavior.
https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor
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. The value can
also change 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.

Different UUID in swift 2.2

Before Swift 2.2 the UUID value was the same every time I opened the app, now changes at every opening
I use this code:
UIDevice.currentDevice().identifierForVendor!.UUIDString
How can I do now to identify the user?
Every time you delete the app, the UUID may change.
If you just close and open the app, it's should be the same.
But if you delete the app (or install it again via xcode), it might change.
There are a couple of answers that explain why the UUID is resetting. There's one that offers a potential work around, but I'd consider it far from ideal. But I want to highlight something important about the way UUID's work that serves as a great workaround that has absolutely zero impact on the production OR debug version of your code base or compiled binary.
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.
All you have to do to prevent this value from changing while developing App-A is to simply install App-B from the same vendor (yourself) and keep it installed during the life time of App-A's development. This is literally as simple as starting a blank new iOS project and install the blank slate to your test device (using the same developer account & such), and then never uninstall it again during development.
App-B keeps a constant UUID for the vendor (yourself) so no matter how many times you delete and reinstall App-A, it will always keep the same UUID.
This actually seems to be a bug IMO. Everytime I run my app in the simulator it generates a new Vendor ID. You can probably get round it by storing the ID into NSUserDefaults on the first bootup then retrieving / comparing the value from NSUserDefaults instead of getting it from identifierForVendor. This will save a static vendor id in defaults but in theory the vendor id will still be changing every boot up.
Kind Regards,
Krivvenz.
Update: I can confirm I have installed multiple apps on the same simulator too but the vendor ID is still changing on every boot.
Update 2: - I have logged this as a bug with Apple - 26195931.
The value of this property is the same for apps that come from the
same vendor running on the same device. A different value is returned
for apps on the same device that come from different vendors, and for
apps on different devices regardless of vendor.
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. The value can
also change 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.
Refer this link for more info.

identifierForVendor returns the same identifier even if I removed all the applications for the same vendors

I'm experimenting a little with the identifierForVendor API.
As per the doc
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. Therefore, if
your app stores the value of this property anywhere, you should
gracefully handle situations where the identifier changes.
In Debug or Release with Ad Hoc, I cannot replicate this behavior. The identifier still remains the same even if I remove all the applications I have installed for the same vendor (the reversed domain name I'm using, e.g. com.test).
Is this can be observed only for App Store distribution? Am I missing something?
I'm running on a iOS 8.3.
Related question: iOS7 - Device unique identifier.

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?
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
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).
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.
You can use my indentifier for vendor plugin
https://github.com/jcesarmobile/IDFVPlugin
It uses the native identifier for vendor https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor

Resources