SSKeychain not retain data

后端 未结 1 638
执笔经年
执笔经年 2021-01-23 00:32

I am using SSKeychain for storing UUID of device. However, sometimes SSKeychain not retains UUID, so my app has to recreate new UUID. Can someone tell

相关标签:
1条回答
  • 2021-01-23 01:15

    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);
    
    0 讨论(0)
提交回复
热议问题