Jac*_*ies 0 iphone ipod objective-c uniqueidentifier ios
可以使用什么[UIDevice currentDevice],比如uniqueIdentifier?谢谢!
因为这有点过时,我现在只是给出一个最新的答案.
因为Apple已经看到适合阻止开发人员使用[[UIDevice currentDevice] uniqueIdentifier];从iOS 6开头Suhail Patels回答建议使用.他们现在已经开始告诉开发人员使用它了[[UIDevice currentDevice] identifierForVendor];,但是一些开发人员对他们是否仍然被允许使用感到困惑,uniqueIdentifier即使他们仍在开发iOS 5中或不开发.Apple只是说这个有点挑剔:
"Apps that use the `UDID` will be rejected in the App Store review process.."
Run Code Online (Sandbox Code Playgroud)
来吧Apple给我们一些细节.
无论如何,由于这背后的混乱,一些开发人员已经开始使用OpenUDID来获取唯一标识符.以下是一些如何使用它的代码:
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
// Use: [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else {
// Use: [OpenUDID value];
}
Run Code Online (Sandbox Code Playgroud)
编辑
一些开发人员现在也认为适合开始使用MAC地址,因为UDID已被弃用.这是因为MAC地址是基于硬件的,因此无法更改.对于那些使用MAC地址的人来说,apple已经提供了一些关于获取MAC地址的示例代码.
| 归档时间: |
|
| 查看次数: |
4052 次 |
| 最近记录: |