Skip to content

Data Storage Alternatives on iOS (in a Nutshell)

by dkberktas on October 16th, 2010

Below you can find the summary of available alternatives for storing data on iOS based machines. Mainly, which one to use depends on your needs like size of data, need of concurrency, access speed, etc.

  • NSUserDefaults
    • Based on plists
    • Store lightweight app state
    • Tutorial (link)
  • Plist — Writing everything out as a plist
    • Not suitable for complex model objects
    • Faster than NSUserDefaults
    • How to load a plist (link)
    • Write & Read data to .plist (link)
  • Archived Objects
    • Conteptual guide (link)
    • Archives provide a means to convert objects and values into an architecture-independent stream of bytes that preserves the identity of and the relationships between the objects and values.
    • Serialization converts Objective-C types to and from an architecture-independent byte stream. In contrast to archiving, basic serialization does not record the data type of the values nor the relationships between them; only the values themselves are recorded. Arbitrary objects cannot be serialized. Only instances of NSArray, NSDictionary, NSString, NSDate, NSNumber, and NSData (and some of their subclasses) can be serialized. (link)
    • Forum post about how to use archiver (link)
  • The joy of SQLite
    • Basically a local file act like a database server
    • Not very good for extreme concurrent access
    • A step by step tutorial (link)
  • Core Data
    • Higher abstraction layer than SQLite
    • Save&load model objects
    • ORM (Rails ActiveRecord, Java Hibernate)
    • Use NSPredicate for in memory filtering
    • Apple Dev Center Article (link)
  • Web Services
    • Store & access remote data
    • XML and Json parsers

ps. Related Stackoverflow entry

From → english, ipad, iphone, tech

One Comment
  1. This is useful, thanks.

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS