I have to implement a UDID-like string for my application. Therefore I used identifierForVendor to make a unique ID for my app and saved it to keychain with SSKeychain, in case it is changed each time the user reinstalls my application.
For each time I have to use the identifier, I will check in keychain whether if it's existed or I create and save one:
-(NSString *)getUniqueDeviceIdentifierAsString
{
NSString *strApplicationUUID = [SSKeychain passwordForService:self.appName account:@"myapp"];
if (strApplicationUUID == nil)
{
strApplicationUUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
[SSKeychain setPassword:strApplicationUUID forService:self.appName account:@"myapp"];
}
return strApplicationUUID;
}
I'm just afraid that the ID will be synced across user's devices then it couldn't be "UDID-like" anymore. I wonder if this is a good practice for my app?