I'm looking for some concept of a 开发者_StackOverflow中文版memory store for my iPhone App. There are some complex NSDictionaries I want to store in memory and read from, rather than parse the JSON stored in a database over and over.
If there is no such thing as a memory store, what options do I have? I tried putting inside user defaults, and reading it back again, but it seems to take just as long as the JSON parsing...
I decided to create a singleton class that contains the data I needed and it's being used by the entire app. Easy, simple and gets the job done
Storing in a binary plist in persistent memory is faster than an xml plist.
Use the NSPropertyListBinaryFormat_v1_0
option with NSPropertyListSerialization
.
精彩评论