1

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.

Amon
  • 99
  • 1
  • 9
  • Check this question: http://stackoverflow.com/questions/11527764/tutorial-on-sskeychain-and-basic-auth-for-ipad-apps – LoVo Jun 27 '16 at 11:54
  • 1
    Possible duplicate of [How to store a string in KeyChain , iOS?](http://stackoverflow.com/questions/16459879/how-to-store-a-string-in-keychain-ios) – Nirav D Jun 27 '16 at 11:57

1 Answers1

1

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"];
bartwader
  • 364
  • 3
  • 4