SSKeychain does not save data

I use SSKeychainto store the UUID of the device. However, sometimes it SSKeychaindoes not save the UUID, so my application needs to recreate a new UUID. Can someone tell me a few reasons why it SSKeychaindoesn't save data.

Thanks in advance!

sorry for my English:)

+2
source share
1 answer

Try this in your appdelegates for Objective-C

NSString *uniqueId = [SSKeychain passwordForService:@"YOUR_PROJECT_IDENTIFIER" account:@"unique_id"];

if ([uniqueId length]==0)
{
      uniqueId = [AppDelegate uuid];
      [SSKeychain setPassword:uniqueId forService:@"Store credentials in Keychain Identifier" account:@"unique_id"];
}
[[NSUserDefaults standardUserDefaults] setValue:uniqueId forKey:@"iPhoneUniqueID"];
NSLog(@"Device_ID:%@",uniqueId);
+1
source

Source: https://habr.com/ru/post/1663095/


All Articles