To apply the concept of multiple managed object context in our application, we will create a separate instance of managed object context with the name custcontext
and associate it with the View of the AddNameController
class. That is, the name of the customer added by the user in the View of AddNameController
class will be stored in this separate context (custcontext) and not in the application's main context: managedObjectContext
. When the Save button is selected (in the View of AddNameController
class), a NSNotification with the NSManagedObjectContextDidSaveNotification
key will be broadcasted that invokes a method, which consequently invokes the mergeChangesFromContextDidSaveNotification
on the main managed object of the application: managedObjectContext
, so that it incorporates all the changes (new customer names added) to the managed object context: custcontext
.
To implement the multiple managed object context...