ios – 在某些情况下UUID是否会发生变化

前端之家收集整理的这篇文章主要介绍了ios – 在某些情况下UUID是否会发生变化前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用用户的设备UUID来获取唯一的设备.
NSString  *currentUUIDString = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

我知道如果应用程序被删除/重新安装(Apple document),UUID会被更改.

但UUID是否因以下情况而改变?

>如果应用已更新. (发现same question)
>如果设备操作系统版本已升级.
>如果做iCloud / iTunes备份和恢复.
>如果设备已重置. (在这种情况下,我认为UUID Keychain存储将无法正常工作.我想,钥匙串存储也会被清除.)

编辑:

不,这不重复,question与如何唯一地识别设备有关,我已经遵循了.我知道我们可以使用UUID唯一地识别设备.但我担心的是UUID可能会改变的频率是多少,如果改变了,那么它可以改变的场景是什么.

解决方法

The device’s identifierForVendor is an excellent way of identifying the device. It will change if the app (and all apps from the same developer) is removed from the device and reinstalled. It does not depend on wifi/Bluetooth connections. With the exception of a bug last year,it does not change with operating systems. …… You could also write your own UUID to the keychain – that survives delete/reinstall of the app…You could also write something to the user’s iCloud key-value file. That would be user-specific rather than device-specific. It also survives delete/reinstall. I think that is what you want.

原文链接:/iOS/334320.html

猜你在找的iOS相关文章