OK. I set user passcode in the view controller:
KeychainItemWrapper *keychainWrapper =
[[KeychainItemWrapper alloc] initWithIdentifier:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"] accessGroup:nil];
[keychainWrapper setObject:@"theUser" forKey:(__bridge id)(kSecAttrAccount)];
[keychainWrapper setObject:_passcode forKey:(__bridge id)(kSecValueData)];
NSLog(@"Saved pass: %@",_passcode);
NSLog(@"Returned pass: %@",[keychainWrapper objectForKey:(__bridge id)(kSecValueData)]);
NSlogs return the same string I set, lets assume it's 1234. Later in AppDelegate I try to retrieve the passcode:
KeychainItemWrapper *keychainWrapper =
[[KeychainItemWrapper alloc] initWithIdentifier:
[[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleIdentifier"] accessGroup:nil];
passcodeViewController.passcode = [keychainWrapper objectForKey:(__bridge id)(kSecValueData)];
NSLog(@"Pass: %@",[keychainWrapper setObject:_passcode forKey:(__bridge id)(kSecValueData)]);
And then the evil comes. NSLog returns: 31323334. What wrong I am doing?