How to store values in keychain of ios
Get contacts of all your emergency needs on single tap. Download Quick-Finder for iPhone
Tutorial for: Key chain, user defaults, values, KeychainItemWrapper, iphone, ios
What is keyChain -
Key chain is the place where we can store the values which will be retain even after deleting application. Generally we store username and password in it.
Difference between KeyChain and userDefaults
The values which are store in userDeafults are deleted when we delete the app from our device but the values stored in KeyChain will not.
Apple provides helper classes, for that you can refer to this link
htps://developer.apple.com/library/ios/#samplecode/GenericKeychain/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007797
Apple provides helper classes, for that you can refer to this link
htps://developer.apple.com/library/ios/#samplecode/GenericKeychain/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007797
Or you can download it from here
Initialise the class
KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"Your application name" accessGroup:nil];
How to save the values
Initialise the class
KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"Your application name" accessGroup:nil];
How to save the values
[wrapper setObject:@"PASSWORD" forKey:@"KEYPASS"];
[wrapper setObject:@"USERNAME" forKey:@"KEYUSER"];
how to retrive the values
NSString *pwd = [wrapper objectForKey:@"KEYPASS"];
NSString *user = [wrapperobjectForKey:@"KEYUSER"];
How to delete the values
[wrapper resetKeychainItem];
Reference: http://stackoverflow.com/questions/6972092/ios-how-to-store-username-password-within-an-app
www.Hypersmash.com
[wrapper setObject:@"USERNAME" forKey:@"KEYUSER"];
how to retrive the values
NSString *pwd = [wrapper objectForKey:@"KEYPASS"];
NSString *user = [wrapperobjectForKey:@"KEYUSER"];
How to delete the values
[wrapper resetKeychainItem];
Reference: http://stackoverflow.com/questions/6972092/ios-how-to-store-username-password-within-an-app