- Get link
- Other Apps
Login and sign up activity is very common in every ios application. Most of the applications follow single sign in process. Single sign in means user have to login only once. Generally developers tend to save values(username, password) in user default. When user delete the application, the values stored in the NSUserDefault also vanishes, then user have to sign in again.
Alternative to NSUserDefault, which save values permanently in keychain:-
Set object:-
NOTE:-
Source:- http://www.escortmissions.com/blog/2011/9/3/steal-this-code-and-protect-their-data-simplifying-keychain.html
Alternative to NSUserDefault, which save values permanently in keychain:-
- Grab the four files (.h and .m) PDKeychainBindingsController folder and add them to your xCode project.
- Import the header file. #import "PDKeychainBindings.h"
Set object:-
[[PDKeychainBindings sharedKeychainBindings] setObject:@"Pardeep" forKey:@"key_name"];
Get object from key:-
NSString *folderPath=[[PDKeychainBindings sharedKeychainBindings] objectForKey:@"key_name"];
Remove object:
[[PDKeychainBindings sharedKeychainBindings] removeObjectForKey:@"key_name"];
NOTE:-
- If you are getting any keychain access error or SecItemAdd and SecItemCopyMatching returns error code -34018, then follow this answer:- http://stackoverflow.com/a/22305193
- keychain API only work with Strings
Source:- http://www.escortmissions.com/blog/2011/9/3/steal-this-code-and-protect-their-data-simplifying-keychain.html
thanks
ReplyDeleteThank you. Keep supporting
ReplyDelete