Every time I uninstall and install my app, a new identifierForVendor
is generated.
I found out that it is an ongoing issue of Apple.
My follow-up question is, will it then be possible for two or more devices to have the same identifierForVendor
if they keep uninstalling・reinstalling?
Teoretically yes, but for practical applications you shouldn’t need to worry about this.
identifierForVendor
is of UUID
type - this wiki page has a section on collision probability for UUIDs in general, not only on iOS. The short of it is that in order to have 50% chance of collision you’d need to generate ~2.71*10^18
identifiers. And thats
equivalent to generating 1 billion UUIDs per second for about 85 years. A file containing this many UUIDs, at 16 bytes per UUID, would be about 45 exabytes.
Also, I wouldn’t say that its an „issue”, but rather a decision choice made by Apple - in the documentation they clearly state that
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.