是否有UDID的永久替代品? [英] Is there a persistent replacement for UDID?

查看:163
本文介绍了是否有UDID的永久替代品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求是UDID在设备重启,操作系统更新,应用程序重新安装和设备重置(例如,用户选择设置">常规">重置")后仍然存在.

My requirement is for a UDID that persists across device reboots, OS updates, app re-installs, and device resets (ie the user chooses Settings > General > Reset).

我并没有试图破坏设备的任何安全性;这是针对金融应用程序的.

I'm not trying to breach any security on the device; this is for a financial app.

据我了解,不赞成使用OpenUDID.鉴于用户可以出于安全原因选择退出,因此我尚未弄清SecureUDID是否有用.

As I understand it, OpenUDID is deprecated. I have not figured out whether SecureUDID is useful, given that users can opt out and for security reasons.

广告客户ID和供应商ID不是永久的.

The advertiser ids and vendor ids are not persistent.

在钥匙串或用户默认/偏好中保存ID似乎不符合我的要求:这些机制似乎不够持久(如上所述).

Saving an ID in keychains or user defaults/preferences does not seem to meet my requirements: those mechanisms don’t appear to be persistent enough (as stated above).

有人有什么建议吗?还是Apple刚刚使其移动设备无法做到这一点?

Does anyone have any suggestions? Or has Apple just made this impossible for their mobile devices?

任何帮助将不胜感激.

推荐答案

根据文档,-[UIDevice uniqueIdentifier]的正式替代品是

The official replacement for -[UIDevice uniqueIdentifier], according to the docs, is identifierForVendor:

该属性的值与在同一设备上运行的来自同一供应商的应用相同.对于来自不同供应商的同一设备上的应用程序,以及与供应商无关的不同设备上的应用程序,将返回不同的值.

The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.

显然,这对您来说不是问题,因为您仅创建一个应用程序.但是,此属性确实有一些限制:

Obviously this isn't an issue for you, since you're only creating one app. However, this property does have a few limitations:

在iOS设备上安装了该应用程序(或来自同一供应商的另一个应用程序)时,此属性中的值保持不变 .当用户从设备中删除该供应商的所有应用程序,然后重新安装其中一个或多个应用程序时,该值将更改.因此,如果您的应用将此属性的值存储在任何地方,则应妥善处理标识符更改的情况.

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.

换句话说,此标识符几乎类似于UDID,但有一个局限性,即当用户从其设备中删除您制作的所有应用时,该标识符将被重置.但老实说,我看不出为什么这对于普通应用程序还不够好.仅当删除并重新安装该应用程序时,identifierForVendor才会重置的唯一情况.它会在重新启动,软件更新等过程中持续存在,因此这实际上不是问题.

In other words, this identifier is almost like a UDID, with the one limitation that when the user deletes all of the apps made by you from their device, this identifier will be reset. But honestly, I can't see any reason why this isn't good enough for the average app. The only case in which identifierForVendor gets reset only when the app is deleted and reinstalled. It persists across reboots, software updates, etc., so it shouldn't really be an issue.

TL; DR 在不违反Apple规则的情况下,目前在技术上无法实现您所要求的,但是identifierForVendor确实应该是一个很好的替代品.我想不出一个合理的理由,为什么您需要一个在应用程序删除和设备重置后仍然存在的标识符.

TL;DR what you are asking for is not currently technically possible without violating Apple's rules, but identifierForVendor really should be a good enough replacement. I can't think of a single legitimate reason why you would need an identifier that persists across app deletions and device resets.

这篇关于是否有UDID的永久替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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