NSUserDefaults
is such an easy and convenient way to persist data on a device, and while it is encouraged as use for basic settings, I wonder, is there a practical limit to what you should use it for?
Suppose you have a large dictionary of many objects, 1000, and each of those objects is itself a dictionary with simple text strings as values. Overall, this big dictionary is probably not too large, since it only contains text, even if a fair amount of it.
Is it O.K. to use NSUserDefau开发者_运维知识库lts
for something like this, your main data model?
Why not just store that as an NSDictionary in a file?
See this post for a nice way to save your file as a plist: Save NSDictionary to plist
and getting it back is as easy as this:
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:fileName];
精彩评论