IdentifierForVendor

12,803

Solution 1

I am fighting the same issue right now. The "answer" is that identifierForVendor is broken per its intended design within the Apple Documentation:

The bundle ID is assumed to be in reverse-DNS format, and the first two components are used to generate a vendor ID. For example, com.example.app1 and com.example.app2 would appear to have the same vendor ID.

What the reality of the situation is that the identifierForVendor is only identical for apps using the same provisioning profile and signing certificate. As an example I have multiple apps in my Enterprise environment, all of which are com.mycompany..

identifierForVendor is identical for apps using the bundleID com.mycompany.app1.* and its provisioning profile however com.mycompany.app2 using the same signing certificate but different provisioning profile yields a different identifierForVendor value.

EDIT: This is only occurring in iOS7 but works fine in iOS6. I tested this for a while yesterday and can duplicate the issue in 7 all day but within 6 I get the expected results.

EDIT2: Apple has moved the goal posts on identifierForVendor. They apparently identified their algorithm problem and, instead of fixing the issue, have changed the identifier's functionality between iOS versions with a documentation change. Updated documentation link is below. SMH.

identifierForVendor

Solution 2

The vendor is not determined by the team ID, but by either:

  • The data provided by the App Store (if the downloaded from the App Store)
  • Parts of the bundle ID (if deployed using any other means)

This varies depending on whether the device is running iOS 6 or 7+.

According to the -[UIDevice identifierForVendor] documentation:

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.

Solution 3

Its because you have 2 different bundle id's.

A vendor is identified by the first two dot separated fields. So com.a.app1 and com.a.app2 have same vendor (com.a) but com.b.app3 has a different vendor (com.b)

Share:
12,803
Pavel
Author by

Pavel

Objective-C, C/C++ developer

Updated on June 09, 2022

Comments

  • Pavel
    Pavel almost 2 years
    NSString *identifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
    

    The code above gives two different identifiers on the same phone in two my applications - different bundle ids but two App IDs and two development provisioning profiles were created on my Apple account.

    How I understand, if the Team ID is the same, the identifier for vendor should be the same in these two apps. Where is the mistake? What I don't understand? first app

    second app