本文介绍了使用KeyChainItemWrapper在KeyChain中存储密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用Apple的示例代码提供的KeyChainItemWrapper类将身份验证令牌保存到钥匙串。I'm using KeyChainItemWrapper class, provided by Apple's Sample Code to save the authentication token to the keychain.KeychainItemWrapper *keychain = [[KeychainItemWrapper alloc] initWithIdentifier"JetTaxiApp_AuthToken" accessGroup:nil]; 但是当我试图将值设置为keychain时,会引发奇怪的异常But when I'm trying to set the value to keychain, an odd exception is raised[_authenticationTokenKeychain setObject:authenticationToken forKey: @"auth_token"]; 钥匙串尚不存在(目前这个电话)什么可能导致这个例外?The keychain doesn't exist yet (at the moment of this call)What can cause this exception?推荐答案你需要使用标准键,所以这里你的 @auth_token不正确。You need to use standard keys, so here your @"auth_token" is incorrect. source,包含有效常量列表:钥匙串服务参考 source, with list of valid constants: Keychain Services Reference例如,您可以使用: 这篇关于使用KeyChainItemWrapper在KeyChain中存储密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-22 03:18