如果不是“IPHONE UDID”该使用什么?
哇...看看本周网上有关使用 iPhone UDID 的所有“恐慌故事”。
[[UIDevice currentDevice] uniqueIdentifier]
我们应该使用什么来代替?
如果手机被卖给另一个用户...并且应用程序已根据手机的 UDID 在远程服务器上存储了一些数据,该怎么办?
(当然,我想避免应用商店的“加密限制”的问题。)
Wow... look at all the "panic stories" online this week regarding using an iPhone's UDID.
[[UIDevice currentDevice] uniqueIdentifier]
What SHOULD we be using instead?
What if the phone is sold to another user... and an app has stored some data on a remote server, based on the phone's UDID?
(Of course, I want to avoid the problems with the app store's "encryption restrictions".)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
一种解决方案是让应用程序发布免费的应用内购买。
此购买将是:
可追踪,具有仅对您的应用有意义的唯一编号(购买)编号。
可移动,如果用户切换设备
可检索,如果应用被删除(或手机被擦除并重新加载) - 应用内购买可以恢复。
One solution would be to have the application issue a free in-app purchase.
This purchase would be:
Trackable, with a unique number (purchase) number which would be meaningful only to your app.
Movable, if the person switches devices
Retrievable, if the app is deleted (or the phone is wiped and reloaded) - the In-App purchases can be restored.
苹果的文档说:
这是一个快速片段:
Apple's documentation says:
Here's a quick snippet:
为什么不使用 Mac 地址,然后可能将其散列起来。
这里有一个出色的 UIDevice-Extension 类别,
您可以可能会用模型来散列这个吗?
Why not use the Mac Address and possibly then hash it up.
There is an excellent UIDevice-Extension Category here
You could possibly hash this with the model?
正如我今天早上在这篇文章中所问的那样,有一些替代方案:
1-首先,按照Apple的建议,识别每次安装识别每个设备。
因此,您可以使用 CFUUIDRef。示例:
2-如果您关心全球唯一标识符,那么您可以将此标识符存储在 iCloud 上。
3-最后,如果您确实需要在应用程序重新安装后保留的标识符(这种情况不会经常发生),您可以使用钥匙串(Apple 的钥匙串文档)。
但苹果团队会喜欢吗?
As I asked this morning in this post, there are some alternative :
1- first, as Apple recommands, identify per install instead of indentifying per device.
Therefore, you can use CFUUIDRef. Example :
2- If you care about a worldwide unique identifier, so you could store this identifier on iCloud.
3- At last, if you really need an identifier that remains after app re-install (that not occurs so frequently), you can use Keychains (Apple's keychain doc).
But will apple team like it ?
UUID 刚刚贬值,所以会存在一段时间,苹果还没有对这种贬值说太多,我会等到他们对此有更多的说法,也许他们会提供一些替代方案。
UUID is just depreciated and so will be around for a while, Apple have not said much about this depreciation much yet, I would wait until they have more to say about this and maybe the will offer some alternative.
像这样:
iOS 文档或多或少描述了使用 CFUUIDCreate() 创建标识符并建议使用 UserDefaults 来存储它。
Like this:
the iOS documentation more or less describes use of CFUUIDCreate() to create an identifier and suggests using UserDefaults to store it.
推荐的方法是使用 UUID 生成,并将其与用户自己愿意提供给应用程序的内容相关联。
然后,将该数据存储在外部,以便可以再次检索。可能还有其他方法可以轻松做到这一点,但这是推荐的方法。
The recommended way is by using UUID generation, and associate that with something that the user him/herself is willing to provide to the app.
Then, store this data externally, where it could be retrieved again. There are probably other ways to do this easily, but this is the recommended way.