Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Keychain in ios programming [closed]

I'm using the Keychain wrapper class provided by Apple. In my application I want to store and retrieve the username and password of the logged in user. When the app is launched again, it should check for the login credentials in the keychain and let the user into the app(automatic login). Tried some sample codes. nothing worked out. Please help me out with the procedure to do this.

Thanks.

like image 615
Pradeep Rajkumar Avatar asked Feb 26 '13 10:02

Pradeep Rajkumar


1 Answers

Use PDKeyChainBindings

This is how to use:

PDKeychainBindings *bindings = [PDKeychainBindings sharedKeychainBindings];
[bindings setObject:@"myuser" forKey:@"username"];
[bindings setObject:@"kmypass" forKey:@"password"];

//How to retrieve
NSString *username = [bindings objectForKey:@"username"];
NSString *password = [bindings objectForKey:@"password"];
like image 186
X Sham Avatar answered Oct 12 '22 22:10

X Sham