gpt4 book ai didi

iphone - 每部 iPhone/iPod Touch 是否都有唯一的 ID?

转载 作者:行者123 更新时间:2023-12-03 20:27:03 26 4
gpt4 key购买 nike

每台 iPhone/iPod Touch 是否都有像 Mac 地址一样的唯一 ID?

我是否必须请求用户授予传输此类唯一 ID 的权限?

最佳答案

是的, 您可以使用 UIDevice 的 uniqueIdentifier 属性来获取它:

A unique device identifier is a hash value composed from various hardware identifiers such as the device’s serial number. It is guaranteed to be unique for every device but cannot publically be tied to a user account. You can use it, for example, to store high scores for a game in a central server or to control access to registered products. The unique device identifier is sometimes referred to by its abbreviation UDID.

编辑: uniqueIdentifier 属性在 iOS5 中已弃用,您现在不应使用它。作为替代方案,您可以生成自己的唯一 ID(例如检查 this questions )。

此外,在 iOS6 中,Apple 添加了 2 个新方法来获取唯一标识符(作为 NSUUID 类的实例):

UIDevice -identifierForVendor:

The value of this property is the same for apps that come from thesame vendor running on the same device. A different value is returnedfor apps onthe same device that come from different vendors, and forapps on different devices regardles of vendor.

ASIdentifierManager -advertisingIdentifier:

Unlike the identifierForVendor property of the UIDevice, the samevalue is returned to all vendors. This identifier may change—forexample, if the user erases the device—so you should not cache it.

关于iphone - 每部 iPhone/iPod Touch 是否都有唯一的 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1476118/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com