无法使用keychainwrapper写入钥匙串

时间:2018-07-27 23:16:01

标签: ios objective-c xcode keychainitemwrapper

我正在尝试使用keychainwrapper将用户名写入钥匙串,一切正常,直到我尝试添加带有-的用户名为止,例如,someone @ some-thing.com

这是我正在使用的代码:

KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:@"something" accessGroup:nil];
    [keychainItem setObject:_tbUsername.text forKey:(__bridge id)kSecAttrAccount];
    [keychainItem setObject:password forKey:(__bridge id)kSecValueData];

但出现以下错误:

*-[KeychainItemWrapper writeToKeychain],/ KeychainItemWrapper / KeychainItemWrapper.m:305中的断言失败 2018-07-28 00:07:42.538336 + 0100 SomeApp [886:131929] * 由于未捕获的异常'NSInternalInconsistencyException'终止了应用程序,原因:'无法添加钥匙串项。'

0 个答案:

没有答案