Search code examples
iphonensuserdefaultscfpreferences

Preferred place to store username


I am dealing with a single username and password in an App, I'm storing the password in the keychain for security but where best to store the username? In NSUserDefaults, CFPreferences or is there a way to retrieve it out of the keychain along with the password.

Later on there might be two entries in the keychain so I think this might be out of the question. Or does it not matter at all?


Solution

  • NSUserDefaults is a good place to store a username, which you can then use to look up a password from the keychain.