Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
726 views
in Technique[技术] by (71.8m points)

iphone - IdentifierForVendor

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...