Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store user info at login for later use

I am building an app where at login, the correct combination of username/password returns some basic user info (firstName, lastName, userType, companyID, etc).

I will be needing those values and strings throughout my application to retrieve user-specific data.

Could I store all those values and strings at login in an NSObject or NSData subclass so that I can later call it to retrieve the items I need? How can I do this? or is there a better alternative?

like image 268
Juan Andres Avatar asked Dec 12 '22 17:12

Juan Andres


1 Answers

If you are just storing the data returned from a successful login like you say, First Name, Last Name etc. I would use NSUserDefaults. If you intend to store any sensitive information such as username or password or anything else requiring additional confidentiality I would recommend using the keychain.

like image 105
rooftop Avatar answered Jan 15 '23 05:01

rooftop