Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

Introduction to Low-Level Core Data Tutorial

Contents:

Who Should Read This Document
Organization of This Document
See Also


This tutorial takes you through the steps of building a very basic Core Data–based command line utility. The goal is to illustrate the creation of a Core Data application entirely in code.

The task goal of this tutorial is to create a low-level Core Data-based utility. It simply records the date on which the utility is run, and its process ID, and prints the run history to the output. It shows that although Cocoa bindings can be used to leverage the functionality in Core Data, it is possible to use Core Data independently. Moreover, it shows all aspects of the creation of a Core Data stack, instantiation of managed objects, and fetching, all without the distraction of a user interface—it even shows the creation of a model in code.

Who Should Read This Document

You will find this tutorial useful if you are using the Core Data framework to create a utility that does not have a user interface or if you want to gain a deeper understanding of the Core Data infrastructure.

Important: This tutorial is not intended for novice Cocoa developers. You must already be familiar with basic Cocoa development tools and techniques. This document does not repeat fundamental Cocoa programming concepts, nor does it provide explicit instructions for common operations in Xcode such as creating new files and adding frameworks to a project.

You should already be familiar with the fundamental Core Data architecture as described in Core Data Basics in Core Data Programming Guide. This tutorial is intended to reinforce the ideas explained in that article.

Organization of This Document

“Overview of the Tutorial” describes the utility you will create, and the task constraints.

“Creating the Project” describes how you create a Foundation Tool project in Xcode, and how you link in Core Data.

“Creating the Managed Object Model” describes how you create the data model for the utility in code.

“The Application Log Directory” illustrates one way to identify and if necessary create a directory in which to save the file for the utility’s persistent store.

“Creating the Core Data Stack” describes how to create and configure the managed object context and the persistent store coordinator in code.

“The Custom Managed Object Class” specifies the Run entity and describes how to implement a custom managed object class.

“Listing Previous Runs” describes how to fetch Run instances from the persistent store.

“Complete Source Listings” shows the complete source code for the project.

See Also

You may want to read these documents if you want a better understanding of Core Data or if you want to use Core Data in a document–based application.

Core Data Programming Guide describes functionality provided by the Core Data framework from a high-level overview to in-depth descriptions.

NSPersistentDocument Core Data Tutorial takes you through the steps of building a document–based application that uses Core Data.



Next Page > Hide TOC


Last updated: 2008-02-08




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice