iosobjective-ccore-datansuserdefaultsmagicalrecord

NSUserDefaults or something else when storing large arrays?


I have an app that reads JSON into in-memory objects. I have one object representing the User and then an array of custom objects. This array is ususally 20-50 objects but can be up to 7-800 in rare cases.

I've read some threads about this, but find it hard to pick, since all i want to do is cache this locally, nothing more, so that i can fetch less from the server.

I can see three solutions:

  1. NSUserDefaults. Not sure how app performance is affected by large array

  2. CoreData / MagicalRecord. Seems nice but a bit complicated

  3. Plist with NSCoding/Decoding

  4. Custom solution.

I am leaning towards NSUserDefaults or Plist since it seems easiest, and i only want to read to and from memory when the app starts/exists. However, is there any issue i should know about, like performance or app startup time when storing so many objects? Is there other reasons for using MagicalRecord?

Pointers much appreciated.

EDIT: Added the plist/NSCoding choice, had forgotten.


Solution

  • Good day, my friend, U have a good question let's understand that it is better to use:

    RESULT : If in fact you need to store some key value and you don't want to bother with knowledge of core data and you have no time for studying, use plist for your data. If you want to store something more difficult and more volume - only coredata. I personally recommend to use coredata, you are convinced that it is easy and convenient, it is necessary to spend time only.

    use plist info

    use core data info