Core Data is a schema-driven object graph management and persistence framework. Fundamentally, Core Data helps you to save model objects (in the sense of the model-view-controller design pattern) to a file and get them back again. This is similar to archiving (see Archives and Serializations Programming Guide for Cocoa), but Core Data offers much more than that. Amongst other things, it:
Provides an infrastructure for managing all the changes to your model objects. This gives you automatic support for undo and redo, and for maintaining reciprocal relationships between objects.
Allows you to keep just a subset of your model objects in memory at any given time. This is especially important on iPhone where conserving memory is critical.
Uses a schema to describe the model objects. You define the principal features of your model classes—including the relationships between them—in a GUI-based editor. This provides a wealth of basic functionality “for free,” including setting of default values and attribute value validation.
Allows you to maintain disjoint sets of edits of your objects. This is useful if you want to, for example, allow the user to make edits in one view that may be discarded without affecting data displayed in another view.
Has an infrastructure for data store versioning and migration. This lets you easily upgrade an old version of the user’s file to the current version.
Core Data is available on iPhone OS v3.0 and later. This document describes tools and techniques for iPhone OS v3.0.
You should read this document to learn how to use Core Data on iPhone, including:
The fundamental design patterns and techniques that underlie Core Data
The basics of using the Xcode data modeling tool
How to create, update, and delete objects managed by Core Data, and how to commit changes to a data store
Important: Core Data is not an entry-level technology. Before starting to use Core Data, you must understand the basics of iPhone application development, including:
How to use Xcode and Interface Builder
Fundamental design patterns such as model-view-controller and delegation
How to use view controllers, navigation controllers, and table views
Documents you should read to gain adequate experience include:
This tutorial comprises the following chapters:
The source code for the tutorial is provided in the Locations sample code.
Last updated: 2009-09-09