21

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)?

Jonny
  • 15,955
  • 18
  • 111
  • 232
  • Keep identifierForVendor or custom UUID in KeyChain. See:[How to preserve identifierForVendor in ios after uninstalling ios app on device?](http://stackoverflow.com/questions/21878560/how-to-preserve-identifierforvendor-in-ios-after-uninstalling-ios-app-on-device%3E) – Reming Hsu Jun 17 '15 at 02:57
  • Let me quote myself "other than saving UUID to keychain, because that method breaks with iCloud syncing". Well, that method could work in some cases. Which means it will not work in **all** cases. – Jonny Jun 17 '15 at 02:59
  • You can make keychain entries device-specific (caveat: I recalled this from a WWDC video and went looking for resources - I haven't had the need to explicitly test this myself). https://www.andyibanez.com/using-ios-keychain/ and https://developer.apple.com/library/ios/documentation/Security/Reference/keychainservices/index.html#//apple_ref/doc/constant_group/Keychain_Item_Accessibility_Constants – Brad Brighton Jun 17 '15 at 03:34
  • I don't think I've seen this mentioned before, but if you use push notifications, maybe you can use the device token as a sort of UUID. Just a thought. – Elliot Alderson Jun 17 '15 at 03:48
  • Hello @Jonny it has been 3 years, 4 months and I'm still getting the same issue. Did apple fix it by any chance? – hamada147 Nov 04 '18 at 11:58

3 Answers3

15

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."

user5018489
  • 166
  • 1
  • 3
1

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

damirstuhec
  • 6,069
  • 1
  • 22
  • 39
0

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.

ChiokJarse
  • 101
  • 1
  • 5