identifierForVendor

@property(nonatomic, readonly, strong, nullable) NSUUID *identifierForVendor

Description:An alphanumeric string that uniquely identifies a device to the app’s vendor. (read-only)

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.
Normally, the vendor is determined by data provided by the App Store. If the app was not installed from the app store (such as enterprise apps and apps still in development), then a vendor identifier is calculated based on the app’s bundle ID. The bundle ID is assumed to be in reverse-DNS format.

On iOS 6, the first two components of the bundle ID are used to generate the vendor ID. if the bundle ID only has a single component, then the entire bundle ID is used.

On IOS 7, all components of the bundle except for the last component are used to generate the vendor ID. If the bundle ID only has a single component, then the entire bundle ID is used.
Table 1 shows a collection of bundle IDs and which portions of the bundle ID the system uses to calculate the vendor ID.

identifierForVendor_第1张图片
For example, com.example.app1 and com.example.app2 would appear to have the same vendor ID.

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. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution. Therefore, if your app stores the value of this property anywhere, you should gracefully handle situations where the identifier changes.

Note:Note
When implementing a system for serving advertisements, use the value in the advertisingIdentifier property of the ASIdentifierManager class instead of this property. Use of that property requires you to follow the guidelines set forth in the class discussion for the proper use of that identifier. For more information, see ASIdentifierManager Class Reference.

描述:这是一个包含文字和数字的字符串,是提供给应用供应商关于设备的唯一性标识,是只读的。

对于来自相同的供应商的运行在同一设备上的多种应用来说,这个属性的值是相同的。但是同一设备上不同供应商提供的应用获取到的这个属性值是不同的,而对不同设备上的多种应用来说无论是否是同一家供应商这个值也是不同的。通常,供应商身份是由苹果商店中提供的数据决定的。如果应用不是通过苹果商店下载安装的(比如企业级应用或者还在开发中的应用),供应商的身份标识则是基于应用的bundle ID计算出来的。bundle ID 以逆向DNS格式来表示。

iOS6中,bundle ID的前两部分用来产生供应商ID。如果bundle ID只有一部分,就会使用整个的bundle ID

iOS7中,除了最后一部分之外所有bundle ID中所有的部分都被用来产生供应商ID。如果bundle ID只有一部分,整个bundle ID会被使用。

表一列举了一些bundle ID以及系统使用bundle ID的哪些部分计算供应商ID

identifierForVendor_第2张图片

例如:com.example.app1com.example.app2 会有相同的供应商ID.

如果这个值为空,等一会再次获取这个值。这种情况一般发生在设备已经重启了但是用户还没有解锁设备的时候。

在应用(或者来自同一供应商的不同应用)安装在设备上的时候,这个属性中的值会一直保持不变。但是当用户从设备中删除了那个供应商提供的所有应用并随后又重新安装,这个值就会发生变化。当使用 Xcode 安装测试包或者在设备上安装ad-hoc发布包的时候,这个值也会发生变化。因此,不管你的应用在哪儿使用了这个值,你都要很好地处理这个标示符发生变化的情况。

如果要实现一个服务广告 的系统,不要使用这个属性,应该使用ASIdentifierManager类中的advertisingIdentifier属性。为了正确使用那个标示符你需要遵守类讨论下面详细的指南,请看ASIdentifierManager Class Reference.

你可能感兴趣的:(技术博客,UUID,官方文档,苹果,iOS)