Working with data in iOS Apps (What to choose? NSData, CoreData, sqlite, PList, NSUserDefaults)

You can use these rules of thumb to decide what storage model will work for your app.

  • If the data fits in memory entirely and is relatively unstructured, use plist
  • If the data fits in memory entirely and has tree-like structure, use XML
  • If the data does not fit in memory and has a structure of a graph, and the app does not need extraordinary query capabilities, use Core Data
  • If the data does not fit in memory, has a complex structure, or the app benefits from powerful query capabilities provided by relational databases, use sqlite
  • If the data must be secret (e.g. a password), use keychain.

Note that these choices often overlap, because multiple storage models will fit the same app. Your final decision depends on your personal preferences – you pick a technology that you understand better.

There was a very good question about sqlite vs. Core Data on Stack Overflow, you may want to read through the answers to that question.

Leave a Comment