0

Is it possible that I can save password for some website in Keychain. Like if you open Gmail in safari iOS and select remember me, it logs in automatically.

any workaround?

thank you.

al

Deam
  • 1,007
  • 2
  • 17
  • 36

2 Answers2

1

You can use the GenericKeychain Apple sample app with the changes I outline in the answer to This question.

Community
  • 1
  • 1
Simon Goldeen
  • 9,080
  • 3
  • 36
  • 45
  • I guess GenericKeychain is valid after 3.2 sdk, but i have 3.1, have OS 10.5 :( – Deam Feb 26 '11 at 16:30
  • The [Keychain Services Documentation](http://developer.apple.com/library/ios/#documentation/Security/Reference/keychainservices/Reference/reference.html#//apple_ref/doc/uid/TP30000898) states that it is available in iOS 2.0 and later. You can probably take pieces of code out of GenericKeychain to make your code work. On a side note, you may want to consider getting Snow Leopard... – Simon Goldeen Feb 27 '11 at 00:03
  • I don't see that where i would spevify that i am goin to save this password info for this server/website? is it kSecAttrService or kSecAttrAccount? – Deam Feb 28 '11 at 09:14
  • don't mind my Qs, i am newbie, 2 days old in this iOS app dev. – Deam Feb 28 '11 at 09:15
  • kSecAttrService and kSecAttrAccount together identify a unique keychain item, you need to specify at least one. To recommend two keys to use for username password, you can use kSecAttrDescription for username and kSecValueData for the password. – Simon Goldeen Feb 28 '11 at 16:34
0

You can simply use NSURLCredential, it will save both username and password in the keychain.

See my detailed answered on https://stackoverflow.com/a/17997943/249869.

Community
  • 1
  • 1
Phil
  • 2,784
  • 2
  • 28
  • 26