Home » IOS » In IOS development, use the key to save the user p...

In IOS development, use the key to save the user password and account

#import "SSKeychain.h" / / the third frame



/ / load user information

- - (void) loadUserInfo

{

Self.username.text = [[NSUserDefaults, standardUserDefaults], objectForKey:@, "usernameKey"];



/ / each shelves application has a unique value.

NSString *str = [NSBundle mainBundle].bundleIdentifier;



Self.password.text = [SSKeychain, passwordForService:str, account:self.username.text];

}



To save the user information in the local / / / / keys

- - (void) saveUserInfo

{

Password: / / keys need to be stored in the password in the

/ / Service: need to pass a unique value, from the application of the

/ / Account / user account: this code is what a user's.



/ / each shelves application has a unique value.

NSString *str = [NSBundle mainBundle].bundleIdentifier;



[[NSUserDefaults, standardUserDefaults], setObject:self.username.text, forKey:@, "usernameKey"];



BOOL isYes = [SSKeychain, setPassword:self.password.text, forService:str, account:self.username.text];



NSLog (@ isYes:%d ', isYes);

}

copyright notice: This article is original article for blogger. Without permission from blogger,.

must not be reprinted

Latest