Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Core Data For Storage for an existing Iphone project?

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

like image 541
Ayrad Avatar asked Dec 02 '22 06:12

Ayrad


1 Answers

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.

like image 157
Ken Aspeslagh Avatar answered Dec 06 '22 00:12

Ken Aspeslagh