跨安装的ios唯一标识符 [英] ios unique identifier across installs

查看:110
本文介绍了跨安装的ios唯一标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要唯一标识设备,并且在安装过程中必须相同(重新安装)。到目前为止,我们一直在使用存储在钥匙串中的标识符,因此它会在安装过程中持续存在。现在使用10.3 beta,卸载应用程序时会自动删除密钥链。
参考: https://forums.developer.apple.com/thread/72271

We need to uniquely identify the device and it has to be same across installs (reinstall). We have been using identifier stored in keychain till now so it persists across installs. Now with 10.3 beta the key chain is auto deleted when the app is uninstalled. Ref: https://forums.developer.apple.com/thread/72271

我们可以使用AdIdentifier作为唯一标识符。我们已投放广告,目前我们正在使用广告。

Can we use AdIdentifier as unique identifier. We have ads served and we are at the moment using it for the same.

推荐答案

似乎有一种解决方法。它实际上是在您链接的论坛中提到的。

There seems to be a workaround. It's actually mentioned in the forum you linked.

通过将钥匙串项目提供给其他应用程序,您可以确保在删除应用程序时不会删除它。

By making the keychain item available to other apps you can ensure it won't be deleted when your app is deleted.

为此,您可以将项目添加到iOS 10上的 kSecAttrAccessGroupToken 访问组。请参阅 https://gist.github.com/Raztor0/34ad0e23a410c33526c9fa1b6e8d281c

To do that, you can add the item to kSecAttrAccessGroupToken access group on iOS 10. See https://gist.github.com/Raztor0/34ad0e23a410c33526c9fa1b6e8d281c

如果您将访问组设置为此知名组,则所有已安装的应用程序都可以读取您的钥匙串项目:

If you set the access group to this well-known group, your keychain item will be readable by all installed apps:


每个应用程序可以访问此访问组,因此不需要在keychain-access-groups权利中明确列出它,但应用程序必须在钥匙串查询中明确说明此访问组,以便能够从外部令牌访问项目。

Every application has access to this access group so it is not needed to explicitly list it in keychain-access-groups entitlement, but application must explicitly state this access group in keychain queries in order to be able to access items from external tokens.

这使得该项目不适合任何敏感或秒ret数据(例如密码,用户名等)。对于设备的唯一标识,这无关紧要。

That makes the item unsuitable for any sensitive or secret data (e.g. passwords, user names etc). For a unique identification of devices this shouldn't matter.

这篇关于跨安装的ios唯一标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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