【发布时间】:2012-03-27 08:44:25
【问题描述】:
我正在使用 github 提供的 ARCified 版本的 KeychainItemWrapper,但我无法使用它来存储电子邮件和密码。
KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:@"myApp" accessGroup:@"MY_APP.com.yourcompany.GenericKeychainSuite"];
[keychainItem setObject:[self.email dataUsingEncoding:NSUTF8StringEncoding] forKey:(__bridge id)kSecAttrAccount];
[keychainItem setObject:self.password forKey:(__bridge id)kSecValueData];
只要我存储一封没有@ 符号 (@) 的电子邮件,我就可以完美地工作。否则,我得到错误
*** Assertion failure in -[KeychainItemWrapper writeToKeychain]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.'
这来自那些行
result = SecItemAdd((__bridge CFDictionaryRef)[self dictionaryToSecItemFormat:keychainItemData], NULL);
NSAssert( result == noErr, @"Couldn't add the Keychain Item." );
您知道这里可能出了什么问题吗?
谢谢
【问题讨论】:
标签: objective-c ios automatic-ref-counting keychain