0
votes

I have a simple NSArray of Jsons in my app. It is an internal cache for my backend searches. That is if a user searches for objects, that gets thrown into my NSArray and should be saved. That array can thus get large, several thousand entries.

I think Core Data, Sqlite etc. all seems overkill to just save that NSArray so it doesn't get lost when the user closes the App. Meanwhile, I understand it is a misuse to just dump this NSArray into NSUserDefaults each time it is updated. Or is it better to write it to a file each time the NSArray gets updated and load it when the in my appdelegate when the app starts?

What is the recommended approach?

2
I think Core Data is not overkill to save an array with thousands of entries.Mundi
thanks, Mundi, after reading further into it, yes, Core Data is actually the only thing that will work for me.axelwittmann

2 Answers

0
votes

As discussed in the comments, I recommend Core Data as a solution for this situation.

0
votes

The easiest way is to use NSJSONSerialization to read from and write to a file.