plist or storage of dictionaries
What is the best way to store a number of dictiona开发者_JAVA百科ries in iOS?
I want to be able to save a new dictionary to the users phone. Is there a way to iterate through the dictionaries in a plist or should it be a plist consisting of an array of dictionaries?
Is plist the best way to do this or is there another way?
How would the array of dictionaries be loaded from the plist and stored in the app? I am trying to load a current plist into an array, but get null values.
You can write a dictionary out using writeToFile:atomically
. If you write them into a directory you can loop through the files in that directory. But don't forget to put them in a writable directory.
Other ideas include saving the files out and saving the file name in the shared preferences.
However, if I were in your position, I would checkout nanostore. I think it will meet all your needs without being as bogged down as core data.
精彩评论