我正在尝试将字符串值存储和检索到我的钥匙串中,我一直在使用此处找到的示例,但是当我调用 mySetObject 方法时,我的应用程序崩溃了。
这就是我用来访问钥匙串类方法 mySetObject 的代码
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Test keychain Wrapper for future use through out connectionClasses
KeychainWrapper *keychainWrapper = [[KeychainWrapper alloc] init];
// set key
[keychainWrapper mySetObject:@"myObj" forKey:@"entry1"]; // this is where my app falls over
// read key
NSString *myAwesomeID = [keychainWrapper myObjectForKey:@"myObj"];
NSLog(@"%@", myAwesomeID);
//..
我在输出中收到的错误如下
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.'
*** First throw call stack:
任何帮助将不胜感激。