在钥匙串中存储电子邮件是不可能的(KeychainItemWrapper)

Nyc*_*cen 18 objective-c keychain ios automatic-ref-counting

我正在使用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];    
Run Code Online (Sandbox Code Playgroud)

只要我存储一封没有符号(@)的电子邮件,我的工作就完美了.否则,我收到错误

*** Assertion failure in -[KeychainItemWrapper writeToKeychain]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.'
Run Code Online (Sandbox Code Playgroud)

哪些来自这些方面

result = SecItemAdd((__bridge CFDictionaryRef)[self dictionaryToSecItemFormat:keychainItemData], NULL);
NSAssert( result == noErr, @"Couldn't add the Keychain Item." );
Run Code Online (Sandbox Code Playgroud)

你对这里可能出现的问题有什么看法吗?

谢谢

Nyc*_*cen 37

好吧,我刚刚在该页面上的建议找到了答案iOS KeychainItemWrapper没有更新,这是要添加的

[keychainWrapper setObject:@"Myappstring" forKey: (id)kSecAttrService];
Run Code Online (Sandbox Code Playgroud)