tauheed
tauheed

Reputation: 160

Is "identifierForVendor" will change on iOS or xCode update?

I have been working in a application and this application need to use a unique ID which is responsible to get connect with server to sync. If this ID would change, my application will lost the connection and all important data should be lost.

Right now I am using "identifierForVendor" but this seems not useful in some condition. Its getting changed in some condition which I mentioned below please check and give some suggestion to overcome from this issue.

"identifierForVendor" getting changed in the condition:

1) Delete app and then reinstalled again using different vendor (always).
2) Delete app and then reinstalled again using even same vendor (random).
3) iOS and xCode update (xCode-7.3/iOS-9.3)(not sure about frequency but on my last update its changed).

Please help me out.

Upvotes: 1

Views: 669

Answers (1)

Ronak Chaniyara
Ronak Chaniyara

Reputation: 5435

Yes, identifierForVendor may change in some cases.

So, you can use SSKeychain to store your unique ID in KeyChain.

Import SSKeychain.h, SSKeychain.m, SSKeychainQuery.h and SSKeychainQuery.m files to your project.

add the Security.framework.

Save unique ID:

[SSKeychain setPassword:@"AnyID" forService:@"AnyService" account:@"AnyUser"]

Retrieve a unique ID:

NSString *UniqueID = [SSKeychain passwordForService:@"AnyService" account:@"AnyUser"];

Edit (as DarkDust suggested):

Download SSKeychain: https://github.com/soffes/SSKeychain

Upvotes: 1

Related Questions