设备 UDID 的替代方案 - 准备我们自己 [英] An alternative to the device UDID - preparing ourselves

查看:34
本文介绍了设备 UDID 的替代方案 - 准备我们自己的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
不推荐使用UIDevice uniqueIdentifier - 现在做什么?

我知道关于 SO 有很多问题,但我认为这是因为 Apple 正在提前推进并积极拒绝使用 UDID 的应用程序 (http://pulse.me/s/7mzKE),我们开发者需要积极主动,批量讨论这个问题.

I know there have been quite a few questions on SO about this, but I think that because Apple is moving ahead of schedule and actively denying applications that make use of UDIDs (http://pulse.me/s/7mzKE), us developers need to take an active approach and discuss this matter in bulk.

所以问题是 - 除了访问它的 UDID 属性之外,什么是唯一设备标识的良好、稳定和正确的替代方法?

So the question is - what is a good, stable and correct alternative for unique device identification, other than accessing it's UDID property?

推荐答案

这取决于您的需求...如果您正在寻找一个简单的设备标识符供您的应用程序使用,那么有关已弃用的 的文档uniqueIdentifier 方法几乎可以为您提供答案:

This depends on your needs...if you're looking for a simple device identifier for your application to use, then the documentation on the deprecated uniqueIdentifier method pretty much provides your answer:

不要使用 uniqueIdentifier 属性.要创建特定于您的应用程序的唯一标识符,您可以调用 CFUUIDCreate 函数来创建 UUID,并使用 NSUserDefaults 类将其写入默认数据库.

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.

CFUUIDCreate 将返回对您的应用程序唯一的唯一手机标识符.您需要将其存储在 NSUserDefaults 中,因为如果您进行后续调用,它会改变.对于大多数用途来说,这已经足够了,而且 Apple 并没有对这种变化提供足够的警告(iOS 5 现在已经发布了六个多月,开发者文档的时间更长).

CFUUIDCreate will return a unique handset identifier that is unique to your application. You need to store it in NSUserDefaults because it will change if you make subsequent calls. For most uses this will suffice, and it's not as if Apple didn't provide enough warning of this change (iOS 5 has been out for over six months now, and the developer docs for longer).

其他场景是您需要跨应用程序(即移动广告网络)共享您的设备标识符.这是一个更复杂的问题,有许多替代选项(也不能保证它们将来会继续存在:Apple 弃用 UDID API 的主要原因可能是停止跨应用程序用户跟踪).

The other scenario is where you need to share your device identifier across applications (ie, mobile advertising networks). That's a more complex problem, with a number of alternative options (there's also no guarantee they'll remain around in the future: Apple's primary reason for deprecating the UDID API is presumably to stop cross application user tracking).

这篇关于设备 UDID 的替代方案 - 准备我们自己的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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