如何使用Objective-c为iPhone / iPad生成设备的唯一ID [英] How to generate Unique ID of device for iPhone/iPad using Objective-c

查看:429
本文介绍了如何使用Objective-c为iPhone / iPad生成设备的唯一ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用Objective-c为iPhone / iPad生成唯一ID设备



以便一旦申请安装在设备上,所以我们应该跟踪那个deviceID




  • 我已经搜索过检索iPhone / iPad的IMEI,但它不是在objective-c中允许。


  • 然后我搜索生成iPhone / iPad的UDID,但每次我在模拟器上启动时都会生成不同的ID。 / p>



解决方案

是, UDID 已弃用;由于用户隐私目的,我们不允许获取UDID。 Apple不允许获取唯一标识设备的标识符,例如 IMEI,MAC地址,UDID 等。



UUID 是迄今为止最好的方式。但这对每个供应商来说都是独一无二的。您不确定每次获得 UUID 字符串时它都是唯一的。最好的办法是将 UUID 字符串存储到手机的 Keychain 中,并在需要时使用catch检索。当您出厂重置手机时,钥匙串项目将被删除。应该牢记这个限制。





更新 - 在IOS 10.3 BETA'中:



Apple似乎对Keychain在 iOS 10.3 + 中的工作方式做了一些改动。当卸载特定供应商的所有应用程序时,存储在钥匙串中的钥匙串项目将删除。根据Apple的说法,即使应用程序从设备中消失,应用程序的敏感信息的驻留可能会带来安全风险,因此他们决定禁止这种行为。



开发人员依赖Keychain存储即使在他们的应用程序卸载后也可以使用这个替代方法继续执行预期的功能。根据此解决方法,任何应用程序都可以访问存储在该特定Keychain访问组中的信息,因此建议为数据添加额外的加密层将以更高的安全性保护它,尽管默认情况下keychain会加密项目。 p>



UPDATE - IOS 10.3.3(STABLE):
看来钥匙串项目删除是一个在iOS 10.3.3的早期测试版中出现BUG,并在稳定版本的后期修复。这可能是在测试期间引起的,因为在该阶段可能会发生奇怪的事情。以后使用Keychain应该没问题。


I wanted to know that How to generate Unique ID of device for iPhone/iPad using Objective-c

so that once application is installed on device , so we should track that deviceID

  • I have searched to retrieve IMEI of iPhone/iPad , but it is not allowed in objective-c.

  • Then I searched to generate UDID of iPhone/iPad but it is generating for different ID each time I launched it on simulator .

解决方案

Yes, UDID is deprecated; we are not allowed to get UDID due to user privacy purposes. Apple does not allow to get any identifiers that uniquely identifies a device, such as IMEI, MAC address, UDID etc.

UUID is the best way to go as of now. But that would be unique for each vendor. You are not assured that it will be unique each time you get the UUID string. Best bet is to store the UUID string to phone's Keychain and retrieve it when needed, with a catch. When you factory-reset your phone, the keychain items would be erased. This limitation should be kept in mind.


UPDATE - IN IOS 10.3 BETA'S:

It seems that Apple has made some changes to how Keychain works in iOS 10.3+. Keychain items stored in the Keychain will be deleted when the all the apps from the specific vendor are uninstalled. According to Apple, the residence of sensitive information of an app even after the app is gone from the device may lead to security risks, so they decided to forbid this kind of behavior.

Developers relying on Keychain storage even after an uninstall for their apps can make use of this WORKAROUND to continue with the intended functionality. According to this workaround, any app can access the information stored in that specific Keychain Access Group, so it is recommended that adding an extra layer of encryption to your data will protect it with even more security, although keychain encrypts items by default.


UPDATE - IOS 10.3.3 (STABLE): It seems that the keychain items deletion was a BUG in early betas of iOS 10.3.3 and was fixed later in the stable release. This might have been caused during betas since strange things can happen during that phase. It should be no problem to use Keychain hereafter.

这篇关于如何使用Objective-c为iPhone / iPad生成设备的唯一ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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