Reputation: 2270
I need to store a dictionary in my app It's life time should be as same as life time of the data stored in NSUserDefaults.
There are few ways to achieve but I am thinking of core data
, NSKeyedArchiever
and NSUserDefaults
.
I am going to update this information frequently and also dictionary is not going to be a large data.
My question is which method is best? because storing and retrieving from NSUserDefault is costly operation.
Upvotes: 1
Views: 1848
Reputation: 80265
- Core Data seems overkill and is really meant to manage larger amounts of data. It would require you to maintain the entire Core Data stack with persistent store, context, model etc.
- NSKeyedArchiver is not meant for frequent changes and certainly much more code than NSUserDefaults.
+ NSUserDefaults
is best for the scenario you describe. It is a simple, transparent and sanctioned API, has a fast underlying database associated with it, can be synched via iCloud etc.
Upvotes: 2