2

SSKeychain用于存储设备的 UUID。但是,有时SSKeychain不保留 UUID,因此我的应用必须重新创建新的 UUID。有人可以告诉我一些为什么SSKeychain不保留数据的原因。

提前致谢!

对不起我的英语不好 :)

4

1 回答 1

1

在你的目标 C 的 appdelegates 中试试这个

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);
于 2016-10-12T07:12:00.377 回答