方法[[UIDevice currentDevice] uniqueIdentifier]不再允许,我需要一个替代方案 [英] Method [[UIDevice currentDevice] uniqueIdentifier] is not allowed any more, I need an alternative

查看:169
本文介绍了方法[[UIDevice currentDevice] uniqueIdentifier]不再允许,我需要一个替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在所有应用中使用 [[UIDevice currentDevice] uniqueIdentifier] ,Apple不允许使用 uniqueIdentifier 了。
我需要一些东西来替换 uniqueIdentifier ,即使用户删除了应用并再次安装它,我也可以使用它来识别用户(并且还可以获得)我的应用程序被苹果批准。)

I'm using [[UIDevice currentDevice] uniqueIdentifier] in all of my apps, Apple is not allowing the use of uniqueIdentifier anymore. I need something to use that replaces the uniqueIdentifier which I can use to recognize a user even when the user deletes the app and installs it again, (and also get my app approved by apple).

谢谢

推荐答案

< a href =https://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/DeprecationAppendix/AppendixADeprecatedAPI.html\"rel =noreferrer>文档建议在此做什么部分。

The documentation recommends what to do in this section.


特殊注意事项

不要使用uniqueIdentifier属性。要创建特定于您的应用程序的唯一标识符,您可以
调用CFUUIDCreate函数来创建UUID,并使用NSUserDefaults类将其写入
默认数据库。

Special Considerations
Do not use the uniqueIdentifier property. To create a unique identifier specific to your app, you can call the CFUUIDCreate function to create a UUID, and write it to the defaults database using the NSUserDefaults class.

要确保在删除应用程序后仍保留唯一标识符,您应将其存储在 keychain 而不是NSUserDefaults。使用钥匙串,您还可以使用钥匙串访问组。这种方法可以防止您在设备不再使用后错误地跟踪用户,并且可以在从备份恢复的任何新iDevice上使用它。

To make sure that the unique identifier remains after you delete the app you should store it in the keychain rather than NSUserDefaults. Using the keychain you will also be able to share the same unique ID across all of your apps on the same device using keychain access groups. This approach will prevent you from incorrectly tracking users after the device is no longer theirs, and it will be available on any new iDevice they restore from backup.

这篇关于方法[[UIDevice currentDevice] uniqueIdentifier]不再允许,我需要一个替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆