iOS---[UIDevice identifierForVendor]慎用!
2016-04-08 10:59
836 查看
An alphanumeric string that uniquely identifies a device to the app’s vendor. (read-only)
用于唯一标示设备的字母数字字符串,每一个供应商都不同呀
OBJECTIVE-C
The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.
对于运行于同一个设备,并且来自同一个供应商的所有App,这个值都是相同的。对于一个设备上来自不同供应商的app,这个值不同;不同设备的app,无论供应商相同与否,这个值都不同。
If the value is
and get the value again later. This happens, for example, after the device has been restarted but before the user has unlocked the device.
如果此值为空,等一会再去获取。用户锁定设备后,再重启设备,此时获取为空,需要解锁。
The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them.
当在设备上安装来自同一个供应商的不同App时,此值保持不变。如果你删除了来自某个供应商的所有app,再重新安装时,此值会改变。
请注意,这个属性只能在iOS6之后使用!
我使用iOS10.1.1测试,通过方法“
[[UIDevice currentDevice]
identifierForVendor].UUIDString
”获取UUID,每次删除App后,重新获取的新值都不同的。
目前解决方法:获取一次后,使用钥匙串保存起来,这样即使你删除了App,再重新安装,只有BundleId不变,那么从钥匙串中获取的UUID不会变的。
用于唯一标示设备的字母数字字符串,每一个供应商都不同呀
Declaration
OBJECTIVE-C@property(nonatomic, readonly, strong) NSUUID *identifierForVendor
Discussion
The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.对于运行于同一个设备,并且来自同一个供应商的所有App,这个值都是相同的。对于一个设备上来自不同供应商的app,这个值不同;不同设备的app,无论供应商相同与否,这个值都不同。
If the value is
nil, wait
and get the value again later. This happens, for example, after the device has been restarted but before the user has unlocked the device.
如果此值为空,等一会再去获取。用户锁定设备后,再重启设备,此时获取为空,需要解锁。
The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them.
当在设备上安装来自同一个供应商的不同App时,此值保持不变。如果你删除了来自某个供应商的所有app,再重新安装时,此值会改变。
请注意,这个属性只能在iOS6之后使用!
我使用iOS10.1.1测试,通过方法“
[[UIDevice currentDevice]
identifierForVendor].UUIDString
”获取UUID,每次删除App后,重新获取的新值都不同的。
目前解决方法:获取一次后,使用钥匙串保存起来,这样即使你删除了App,再重新安装,只有BundleId不变,那么从钥匙串中获取的UUID不会变的。
相关文章推荐
- 绝大部分 Android 手电筒应用需要大量权限
- 这些看似合法的 iPhone Lightning 数据线将劫持您的电脑
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- udev 入门:管理设备事件的 Linux 子系统
- 我的iPhone桌面
- PHP实现连接设备、通讯和发送命令的方法
- 三种检测iPhone/iPad设备方向的方法
- js实现iPhone界面风格的单选框和复选框按钮实例
- PHP实现根据设备类型自动跳转相应页面的方法
- javascript实现根据iphone屏幕方向调用不同样式表的方法
- android Gallery组件实现的iPhone图片滑动效果实例
- Android中修改设备权限的方法
- Android仿iphone自定义滚动选择器
- js判断手机端(Android手机还是iPhone手机)
- js判断浏览器类型及设备(移动页面开发)
- 使用Objective-C获取IPHONE手机IMSI序列号
- 探讨Android 的屏幕滚动操作不如 iPhone 流畅顺滑的原因
- iphone的safari浏览器中实现全屏浏览的方法