SSKeychain不保留数据
我正在使用SSKeychain
来存储设备的UUID。 但是,有时SSKeychain
不保留UUID,所以我的应用程序必须重新创build新的UUID。 有人可以告诉我为什么SSKeychain
不保留数据的一些原因。
提前致谢!
对不起我的英语不好 :)
在Objective 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);