What actually happens behind the scenes when you select the "Use Core Data for storage" option when creating a new Window based project in Xcode? I'm trying to use Core Data in a project that I've already created, and I'm having a hard time figuring out how to include the framework properly in my Xcode project...
Thanks!
In addition to importing <CoreData/CoreData.h>
, there is a template which populates the application delegate implementation with the following methods:
-managedObjectContext
-managedObjectModel
-persistentStoreCoordinator
which initialize the applicaton's managedObjectContext
, managedObjectModel
and persistentStoreCoordinator
members. (The application delegate header is populated with hints to these methods, the associated member variables and their property descriptions.)
The template also adds code to -applicationWillTerminate:
which writes changes to the managedObjectContext
.
The easiest way to figure out what to add (and, more importantly, why) is to go through the iPhone Core Data tutorial, which should be findable from the Apple Developer Center website via its search engine, or via your favorite search engine. I will not add links here, so as not to cause offense.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With