I am trying to use keychain in iOS to store small bits of information - password strings, OAuth tokens, etc. I use the KeychainItemWrapper sample code that Apple provides here:
https://developer.apple.com/library/ios/#samplecode/GenericKeychain/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007797
I found it extremely buggy! Sometimes this works while my application crashes when trying to save string values ββin a keychain, especially when something is already installed. In other cases, the same calls work fine. Errors occur on real devices, not in the simulator.
I usually write to the keychain as follows:
KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"password" accessGroup:nil];
[wrapper setObject:thePasswordString forKey:(id)kSecValueData];
[wrapper release];
So, I would like to know that I am doing something wrong, is this an example of Apple's code that is to blame, or is the actual basic IOS API for key fobs?
source
share