微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ios – 创建生命周期唯一ID的替代方法

我想为iPhone / ipad设备创建UDID,这将保持不变,所以请告诉我,如果有人有想法?

搜索google和stack-overflow,但没有解决方案.

还有一些建议使用OpenUDID和CFUUID,但是当用户删除并重新安装应用程序时,CFUUID会不同.但是我想为每个应用程序使用相同的UDID,这将在第一次生成,并且每个应用程序的每个设备的使用寿命应该保持不变.

解决方法

编辑2

由于iOS升级,并且根据新文档,标识符FORvendor不会保留应用程序重新安装的价值.我在this link看到答案.这可能以一种或另一种方式帮助.只是要注意,即使系统重置,UDID也将保留,所以即使系统重置,寻求终身UDID的开发人员也可能会遇到这个答案.除此之外,提到的答案似乎很有用.

还要看summary here.

identifierForvendor可从UIDevice Class Reference.开始

The value of this property is the same for apps that come from the
same vendor running on the same device.

[[UIDevice currentDevice] identifierForvendor].UUIDString

注意:iOS 6.0及更高版本中可用.

编辑1根据UIDevice Class Reference的新版本

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. Therefore,if
your app stores the value of this property anywhere,you should
gracefully handle situations where the identifier changes.

编辑

我希望你能在this popular link看到

1)MAC CFBundleIdentifier的MD5

[[UIDevice currentDevice] uniquedeviceidentifier]

每个应用程序仍然保持不变,但每个应用程序不同.如果您删除并重新安装应用程序,则每个应用程序都会相同.

2)MAC的MD5

[[UIDevice currentDevice] uniqueGlobaldeviceidentifier]

对于所有来自同一设备的应用,这一点将保持不变.如果您删除并重新安装应用程序,则每个设备将相同.

编辑3

注意:iOS7中的此解决方案不再有用,因为iOS7不再可用uniqueIdentifier.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐