how to store a string from a uitextfield to KeyChain

201 views Asked by At

I wana store a string in KeyChain. I am trying to use SSKeychain.h, SSKeychain.m, SSKeychainquery.h and SSKeychainquery.h

As there are many methods present in these files. So am confuse and want to know which method to use and how. The string to store is a password to my application.

1

There are 1 answers

1
bartwader On

You can try this variant:

// Store credentials in Keychain
[SSKeychain setPassword:@"thePassword"
                     forService:@"com.yourCompany.yourApp"
                        account:@"theUserName"];

// Retrieve credentials from Keychain 
NSString *password = [SSKeychain passwordForService:@"com.yourCompany.yourApp"
                                                account:@"theUserName"];