gpt4 book ai didi

ios - [UIDevice currentDevice] 可以使用什么?

转载 作者:行者123 更新时间:2023-11-28 18:02:25 26 4
gpt4 key购买 nike

[UIDevice currentDevice]可以带什么,比如uniqueIdentifier?谢谢!

最佳答案

因为这有点过时了,所以我只是给出一个最新的答案。

因为 Apple 认为从 iOS 6 开始,停止开发人员使用 [[UIDevice currentDevice] uniqueIdentifier]; 是合适的, Suhail Patels 回答使用建议。他们现在已经开始告诉开发人员使用 [[UIDevice currentDevice] identifierForVendor];,但是一些开发人员对是否仍然允许他们使用 uniqueIdentifier 感到困惑,即使他们仍然是否为 iOS 5 及以下版本开发。 Apple 对这句话有点挑剔:

"Apps that use the `UDID` will be rejected in the App Store review process.." 

来吧 Apple 给我们更多的细节。

无论如何,由于这背后的困惑,一些开发人员已经开始使用 OpenUDID获得唯一标识符。以下是有关如何使用它的一些代码:

    if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
// Use: [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else {
// Use: [OpenUDID value];
}

编辑

由于 UDID 已被弃用,一些开发人员现在也认为开始使用 MAC 地址是合适的。这是因为 MAC 地址是基于硬件的,因此无法更改。对于那些想要使用 MAC 地址方式的人,苹果在 Getting MAC Address 上提供了一些示例代码。 .

关于ios - [UIDevice currentDevice] 可以使用什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7128828/

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