Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device ID change #163

Closed
percramer opened this issue Dec 17, 2015 · 3 comments
Closed

Device ID change #163

percramer opened this issue Dec 17, 2015 · 3 comments

Comments

@percramer
Copy link

Is the device id that is returned on an iPad the actually unique device id? Because it looks like it is changing after a new install

@jamesmontemagno
Copy link
Owner

The source code is literally right here in the repo:

 public string Id
    {
      get
      { 
        // iOS 6 and up
        return UIDevice.CurrentDevice.IdentifierForVendor.AsString();
      }
    }

here is the documentation: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/identifierForVendor

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

Declaration
SWIFT
var identifierForVendor: NSUUID? { get }
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.

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.

Table 1Example bundle identifiers
Bundle ID
iOS 6.x
iOS 7.x
com.example.app1
com.example.app1
com.example.app1
com.example.app2
com.example.app2
com.example.app2
com.example.app.app1
com.example.app.app1
com.example.app.app1
com.example.app.app2
com.example.app.app2
com.example.app.app2
example
example
example
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.

@mike-appwiz
Copy link

Can you please explain this line..
The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them.

@jamesmontemagno
Copy link
Owner

@mike-appwiz You would have to ask Apple as I copied and pasted from the docs.

It seems like if they uninstall or install the app then it would change the id I guess from a vendor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants