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.