identifierForVendor 在重新安装时发生变化

identifierForVendor changes on reinstall

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.

https://developer.apple.com/reference/uikit/uidevice/1620059-identifierforvendor

不过,我刚刚在应用商店中使用我们的一款实时应用对此进行了测试。即使我们的许多其他应用程序仍安装在设备上,如果我重新安装应用程序 A,identifierForVendor 返回的 UUID 每次都会更改。

不是这样的

这曾经有效。但是在某些时候,UUID 似乎已经开始在 "simple reinstalls" 上发生变化(如上所述)。这是一个已知的错误?与上述文档相比,identifierForVendor 是否已知已损坏?任何解决方法(除了将 UUID 保存到钥匙串,因为该方法会破坏 iCloud 同步)?

这是一个已知错误。似乎 Apple 对 AppStore 进行了更新,导致 identifierForVendor 在 28:th 5 月左右出现这种新行为。如果您在 App Developer 论坛中搜索,还有其他开发者报告了同样的问题。

Apple 的签名 gc 已针对此问题做出如下答复: "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."

我们将使用应用程序组授权重新提交以提供共享的 NSUserDefaults。听起来 App Group NSUserDefaults(不像 keychain-access-group 和 iCloud key-value storage entitlements)是在设备上共享的,而不是通过 iCloud 帐户共享的。如果共享 "deviceid" NSUserDefault 密钥不存在,我们将保存 IdentifierForVendor ID,然后在保存后将其用于我们所有的应用程序。

identifierForVendor 预计会在所有供应商的应用程序从设备中删除后发生变化。此外,如果您直接从 Xcode 构建和安装,它肯定会发生变化。

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.

来源:UIKit/UIDevice/identifierForVendor