Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IdentifierForVendor

Tags:

ios

iphone

ios6

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

like image 473
Pavel Avatar asked Mar 20 '13 16:03

Pavel


People also ask

What is identifierForVendor?

An alphanumeric string that uniquely identifies a device to the app's vendor.

Is identifierForVendor unique?

The identifierForVendor is an unique identifier that stays the same for every app of a single vendor on a single device, unless all of the vendor's apps are deleted from this device. See Apple's documentation about when this UUID changes.

What is an IDFV?

The definition of IDFV? The Identifier for Vendors (IDFV) is a code assigned to all apps by one developer and is shared across all apps by that developer on your device. The value of the IDFV is the same for apps from the same developer running on the same device.

How do I identify a device in iOS Swift?

There is no longer a way to uniquely identify a device after the user uninstalled the app(s). The documentation says: The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device.


3 Answers

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

like image 85
Dan Avatar answered Oct 12 '22 23:10

Dan


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.

like image 37
Michael Voong Avatar answered Oct 12 '22 23:10

Michael Voong


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)

like image 27
Shireesh Avatar answered Oct 13 '22 01:10

Shireesh