Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anything I shouldn't save in NSUserDefaults

I've just got started with RubyMotion and, from what I can tell, it suggests using NSUserDefaults for a datastore. This seems kind of strange to me as the name suggests that it should be only used for storing config variables etc and not objects.

Is it okay to store my objects (such as User, Company, Tasks etc) in NSUserDefaults or should I use another approach?

like image 503
Gerard Avatar asked Dec 27 '22 07:12

Gerard


1 Answers

User defaults are generally OK for storing small amounts of data that does not need encryption. The data which is large or could potentially grow over time should go either into the file system or into Core Data. Anything that needs to be secret (e.g. passwords) must go into keychain.

Here is an answer with suggestions on how to choose among the storage models for your app.

like image 171
Sergey Kalinichenko Avatar answered Jan 15 '23 03:01

Sergey Kalinichenko