Using keychain to store username and password in xcode 4
Asked Answered
M

2

6

I don't want to use NSUserDefaults as I have been told it's not a good way to save a username and password.

So I was going to use a Keychain, but I have never used them before. Can some one please just a give a quick example of one or point me in the direction of an example ? Thanks.

Metamorphose answered 20/12, 2011 at 8:19 Comment(0)
F
12

I Use the open source SSKeychain wrapper around the the C api used by the keychain.

It's convenient, easy to use, and works on Mac OS and iOS.

Financier answered 20/12, 2011 at 9:13 Comment(5)
+1 for great wrapper. Will this work on the simulator as well?Tanhya
Works for me when I'm testing on the simulator.Financier
I asked because I have heard that generic keychain for ios does not work on simulator. Is sskeychain a wrapper for geenricKeychain? if yes than even it should not work.. ?Tanhya
@Financier it says that it doesn't support in MAC 10.6 Does it support in Mac 10.7.4?Ced
That's what it generally means when people specify support. If it doesn't support 10.6 it supports everything later than that.Financier
T
4

This is the best I have found till date... It five a very simple implementation of saving passwords and username to keychain. Please remember to include security framework in your project.

https://web.archive.org/web/20160305031351/http://iosdevelopertips.com/core-services/using-keychain-to-store-username-and-password.html

Keep in mind that this doen't work on simulator.

Tanhya answered 20/12, 2011 at 8:31 Comment(1)
The SSKeychain mentioned by Abizem seems the best option to me as it is very easy to implement.Tanhya

© 2022 - 2024 — McMap. All rights reserved.