views:

478

answers:

1

Hello,

According to the Apple Core Data Tutorial, in order to use Core Data you have to:

In the Options section, select the switch to use Core Data for storage.

How do it for an existing project? Do you have to import some files? Can that setting be activated later on?

Thanks

+7  A: 

Selecting that option automatically adds the CoreData.framework, an empty data model, and a little bit of Core Data code to the AppDelegate and View Controllers classes.

If you want to start using CoreData in your existing project;

1) Add CoreData.framework to the project.

2) Do "New File", go to "Resource", and add a new "Data Model" to the project.

3) Create a temporary new project (check that use Core Data box). Then, you can look and see the Core Data-related code that it added to those template files. Carefully merge that stuff into your existing AppDelegate.

4) You should be all set to pick up the tutorial from that point.

Ken Aspeslagh
It also adds #import <CoreData/CoreData.h>to the prefix header.Also note that using Core Data will make your project require OS 3.0 or higher.
Ken Aspeslagh