Storing data permanently in an iPhone is usually done using Core Data or sqlite3. Most people prefer to user NSUserDefaults as a storage for application preferences, rather than using it as a normal database (such as sqlite).
I have found that large amount of data can be stored in NSUserDefaults, it is extremely easy to use and it is fast. So why not use this as a permanent storage? What are the limitations of NSUserDefaults as a database?
Update:
I frequently use three different ways of saving my data to disk.
- Core data
- Serializing objects to plists
- NSUserDefaults
I do not use FMDB (or sqlite directly) anymore. What are the main advantages and disadvantages of each approach?
Some advantages of NSUserDefaults that I've come across:
- Sorting, grouping, etc. can easily be done using NSPredicate.
- NSUserDefaults is thread safe.
- It takes one line to fetch and save data to NSUserDefaults.