我使用Apple的示例代码提供的KeyChainItemWrapper类将验证令牌保存到钥匙串中。使用KeyChainItemWrapper在KeyChain中存储密钥
KeychainItemWrapper *keychain = [[KeychainItemWrapper alloc] initWithIdentifier"JetTaxiApp_AuthToken" accessGroup:nil];
但是,当我试图将值设置为钥匙扣,奇数引发异常
[_authenticationTokenKeychain setObject:authenticationToken forKey: @"auth_token"];
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.'
钥匙串尚不存在(在此调用的瞬间) 什么会导致此异常?
确保您添加了钥匙串访问plist文件。 看看http://stackoverflow.com/questions/5859615/iphone-debugging-the-generickeychain-example – nessalabs