Understanding multiple managed object context
In multiple managed object context concept, we make several instances of managed object context and each instance works independently without having knowledge of what modifications are implemented in other instances. In order to keep all instances informed of different modifications performed in each context, a notification is broadcasted by a managed object context when any save or delete operation is performed on it. Like, if a managed object context completes a save operation, it broadcasts an NSNotification with the NSManagedObjectContextDidSaveNotification
key.
The benefit of this notification is that any managed object context that listens to the notification NSManagedObjectContextDidSaveNotification
can update its contents by invoking the method mergeChangesFromContextDidSaveNotification:
. This method updates the contents of managed object context (with the managed object context that broadcasted the notification) and will also notify...