Chapter 12. Reading and writing application data

 

This chapter covers

  • Core Data basics
  • Data models
  • The NSFetchedResultsController class
  • Data validation and performance

How useful would the Contacts application be if all your contacts were gone when you quit the application? Or how useful would the Notes application be if all your notes were lost when you turned off your iPhone? Not very useful at all. What is the one thing that makes these and most other applications useful? It’s data persistence: the permanent storage of data that “survives” the closing of an application or even the restart or shutdown of the device.

Data persistence is needed in almost every application in one way or another. In a game, you might need to save high scores, user data, or game progress. In a productivity application, you want to save, edit, and delete to-do list items. Or in an RSS reader application, you want to save which feeds the user subscribes to. How do you persist data on the iPhone?

12.1. Core Data history

12.2. Core Data objects

12.3. Core Data resources

12.4. Building the PocketTasks application

12.5. Beyond the basics

12.6. Summary