What is the easiest correct way to store a session that tells whether or not a user is logged in? I could possibly even store basic information in memory (a logged-in user’s first and last name, etc.).
I’ve heard about singleton objects but I’m not sure if that is a solution or not. My main objective is to store basic user info for an application.
Could this work?
[[NSUserDefaults standardUserDefaults] valueForKey:@"someKeyName"]
I’m not sure if this is efficient, though, if I plan to use it for about 8 values.
A singleton would be fine if you’re not going to store any of the information in between sessions.
For example, if you wanted to save a user’s email address so they don’t have to fill it out every time to log in, you’ll need to use
Just like in your question.