I am making a web app which needs to store a user’s email and password for a web service, which it then connects to. Rather than them have to enter this each time, I want it to save when the app closes.
How should I do this? Do I need to use core data or SQLite for just two strings, or is there another, better way to do this?
Thanks.
Don’t store the password as plain text. Even if it is supposed to be “unimportant” and “insecure”. If possible, consider not storing it at all (store hash, for example, or get a cookie from the web service on first authorization). In that case,
NSUserDefaultswould be a standard and easy way for storing such data.If you do have to store the password, the system key chain is the secure place for that. Look for
SecKeychainAddGenericPasswordAPI function, it will lead you to Keychain Services Guide and examples.