iOS identifierForVendor 是否可以重复?
is it possible for iOS identifierForVendor to be duplicated?
每次我卸载和安装我的应用程序时,都会生成一个新的 identifierForVendor
。
我发现它是 Apple 正在进行的 。
我的后续问题是,如果两个或多个设备一直卸载・重装,是否有可能具有相同的identifierForVendor
?
理论上是的,但对于实际应用,您不需要担心这一点。
identifierForVendor
属于 UUID
类型 - this wiki page 有一个关于一般 UUID 冲突概率的部分,而不仅仅是 iOS。简而言之,为了有 50% 的碰撞几率,你需要生成 ~2.71*10^18
标识符。那就是
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.
此外,我不会说这是一个“问题”,而是 Apple 做出的决定选择 - 在 documentation 他们明确指出
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.
每次我卸载和安装我的应用程序时,都会生成一个新的 identifierForVendor
。
我发现它是 Apple 正在进行的
我的后续问题是,如果两个或多个设备一直卸载・重装,是否有可能具有相同的identifierForVendor
?
理论上是的,但对于实际应用,您不需要担心这一点。
identifierForVendor
属于 UUID
类型 - this wiki page 有一个关于一般 UUID 冲突概率的部分,而不仅仅是 iOS。简而言之,为了有 50% 的碰撞几率,你需要生成 ~2.71*10^18
标识符。那就是
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.
此外,我不会说这是一个“问题”,而是 Apple 做出的决定选择 - 在 documentation 他们明确指出
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.