Use Core Data For Storage for an existing Iphone project?
According to the Apple Core Dat开发者_如何学JAVAa 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
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.
精彩评论