I have been trying to add keys to the keychain in iOS 8. I have tried the example: https://developer.apple.com/library/mac/documentation/security/conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html#//apple_ref/doc/uid/TP30000897-CH208-SW3 and using various libraries including: JNKeychain. With JNKeychain, the following code produces a null result:
- (IBAction)btnClick:(id)sender {
[JNKeychain saveValue:@"[email protected]" forKey:(__bridge NSString*)(kSecAttrAccount)];
NSData *data = [JNKeychain loadValueForKey:(__bridge NSString*)(kSecAttrAccount)];
NSString *email = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"Email: %@", email);
}
I was expecting that this code would return "Email: [email protected]". Can anyone help me figure out what I'm doing wrong?