Introduction
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), 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 iOS 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 iOS 3.0 and later.
You should read this document to learn how to use Core Data on iOS, 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
Organization of This Document
This tutorial comprises the following chapters:
The source code for the tutorial is provided in the Locations sample code.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-12-13)