Chapter 26

Introduction to Core Data

The Core Data framework provides solutions to tasks commonly associated with managing the life-cycle of objects in your application, including object persistence. In this lesson you will learn to use Core Data to implement simple object persistence in your applications.

Basic Concepts

Core Data is based on the Model-View-Controller pattern and essentially fits in at the model stage. Core Data introduces a few new concepts and terminology, which are discussed briefly in this section.

Managed Object

A managed object is a representation of the object that you want to save to the data store. This is conceptually similar to a record in SQL and typically contains fields that correspond to properties in the object you want to save.

Managed Object Context

The managed object context is akin to a buffer between your application and the data store. It contains all your managed objects before they are written to the data store. Inside this context you can add, delete, or modify managed objects. Most of the time, when you need to read, insert, or delete objects you will call methods on the managed object context.

Persistent Store Coordinator

The persistent store coordinator represents the connection to the data store and contains low-level information like the actual name and location of the data store to be used. This class is generally used by the managed object context.

Managed Object Model

This is a class that contains definitions for each of the managed ...

Get iPhone and iPad App 24-Hour Trainer now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.