iphone - 如何在 iPhone 上生成良好的、不变的 UDID

标签 iphone ios5 privacy

在 iOS 5 中,已弃用 [[UIDevice currentDevice] uniqueIdentifier] 的使用。现在鼓励我们使用自己生成的 UUID 并将其存储在应用程序的 NSDefaults 中。我想这对于大多数用途来说都可以。

但我的问题是 - 是否有可能以某种方式生成类似于现在设备 ID 的 UUID - 即使在删除并重新安装应用程序后我也希望保持它相同。这样做的目的是帮助追踪从 iPhone 上获取的可能的欺诈行为。

我想知道是否使用 MAC 地址,如此类别的:https://github.com/erica/uidevice-extension/blob/master/UIDevice-Hardware.m可以吗?

最佳答案

文档中对 uniqueIdentifier 属性的讨论指出:

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.

将其写入用户默认值应该确保如果应用程序被删除/重新安装我会保留它。

编辑:

抱歉,they are not kept when an application is removed显然。 documentation描述了如何生成 UUID,但我无法确定它对于给定用户/设备是否恒定。我看到有人建议使用keychain通过应用程序删除/重新安装来实现持久性,但不知道它有多值得推荐(并且在任何情况下,我想用户都可以删除这些条目)。

关于iphone - 如何在 iPhone 上生成良好的、不变的 UDID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8226549/

相关文章:

iphone - 显示调用 View 生命周期(viewDidAppear 等)的 View Controller 的完整方法列表是什么

iphone - 将图像添加到 UiTextView 并发布

algorithm - 数据匿名化技术

google-chrome - 为什么 Chrome 使用 sec-ch-ua : "\"Not\\A;Brand";v ="99"?

iphone - 使用企业分发配置文件控制谁使用 iOS 企业应用程序?

iphone - MapKit map View :viewForAnnotation has no effect on pin color

iphone - audioPlayerDidFinishPlaying : called之后的EXC_BAD_ACCESS

ios - 在初始化时向 UIView 添加 subview

ios - 如何通过代码判断iPad是黑色还是白色?

facebook - 应用程序 Activity 隐私和 app_non_users