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
andNSUserDefaults
.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.
Asked
Active
Viewed 1,845 times
1

jailani
- 2,260
- 2
- 21
- 45
-
Why `storing and retrieving from NSUserDefault is costly operation`? – Yogesh Suthar Aug 18 '14 at 07:08
-
You can use NSUserDefaults for small information. Why is using NSUserDefaults a costly operation? – Matz Aug 18 '14 at 07:11
-
@YogeshSuthar It is going to be read/ write in the disc right? So It is always expensive operation. If I do this frequently then It is expensive only? – jailani Aug 18 '14 at 08:26
-
you can check this answer..http://stackoverflow.com/a/10245064/1865424 – Kundan Aug 18 '14 at 09:33
1 Answers
2
- 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.

Mundi
- 79,884
- 17
- 117
- 140