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

Next Page > Hide TOC

Introduction to NSPersistentDocument 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 simple Core Data–based application using NSPersistentDocument and Cocoa bindings. NSPersistentDocument is a subclass of NSDocument that integrates with the Core Data framework. You will find this tutorial useful if you’re using the Core Data framework to create a document-based application.

The task goal of this tutorial is to create a document-based application that allows a user to display and modify information about a department, employees in the department, and managerial relationships between the employees.

Who Should Read This Document

You should read this document to gain an understanding of how to create a Core Data document-based application using NSPersistentDocument and Cocoa bindings. Among other concepts, you will learn how to create the project, how to customize the creation of a document, and how to localize error messages.

Important: To complete this tutorial, you should already be familiar with basic Cocoa development practices and with Cocoa bindings. This document does not repeat fundamental Cocoa programming concepts and does not provide explicit instructions for common operations (such as using Interface Builder, including establishing bindings between user interface objects and controllers). You should, for example, ensure that you that you understand the material presented in Cocoa Application Tutorial Using Bindings.

Organization of This Document

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

“Creating the Project, Model, and Interface” describes how you create a Core Data document-based project in Xcode, and how you create the data model and how you can use it to automatically create a default user interface.

“Creating a Custom Class” describes how to implement a custom class for an entity.

“Adding a Department Object” describes how you add a Department object to the document, and configure the user interface appropriately.

“Copy and Paste” describes one way you can support copy and paste in a Core Data application.

“Localizing and Customizing Model Property Names and Error Messages” describes how you can localize property names and customize alert panels.

“Document Metadata” describes how you can add metadata to your document that Spotlight can extract—it also describes how you write the Spotlight importer.

“A Sheet for Creating a New Employee” describes how you can use a sheet for data entry.

See Also

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

Low-Level Core Data Tutorial takes you through the steps of building a command-line utility that uses Core Data. You are strongly encouraged to complete the low-level tutorial before following this tutorial.

Note: The source code for the application described in this tutorial is available here: Departments and Employees.



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