UIDevice.IdentifierForVendor Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An identifier, unique to the device, based on the App Store vendor or, if not from the App Store, the bundle identifier.
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual Foundation.NSUuid IdentifierForVendor { [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)] [Foundation.Export("identifierForVendor", ObjCRuntime.ArgumentSemantic.Strong)] get; }
member this.IdentifierForVendor : Foundation.NSUuid
Property Value
- Attributes
Remarks
This identifier is the same for a particular device for all apps that come from the same vendor. This identifier is not the same across devices.
If the app does not come from the App Store, the "vendor" of the device is calculated based on the bundle ID. In iOS 7 and later, the "vendor" is based on all elements of the bundle ID except the last component. In other words, if the bundle ID is com.mycompany.mydivision.app1
, the "vendor" will be calculated as com.mycompany.mydivision
. On iOS 6 and previous, the "vendor" is calculated from the first two components, so a bundle ID of com.mycompany.mydivision.app1
would base the vendor on com.mycompany
.
The AsString() method is often used to extract the actual identification, as shown in the following example:
var nsUid = UIDevice.CurrentDevice.IdentifierForVendor;
var guidElements = nsUid.AsString();
Console.WriteLine("ToString() : {0}\nAsString() : {1}", nsUid, guidElements);
/*
ToString() : <__NSConcreteUUID 0x79ef50> 959E8282-D65E-486C-B1D3-17D720CF668E
AsString() : 959E8282-D65E-486C-B1D3-17D720CF668E
*/
This can be used from a background thread.