Contents

NSManagedObjectContextDidSaveNotification

A notification that posts after a context finishes writing unsaved changes.

Declaration

extern NSString * const NSManagedObjectContextDidSaveNotification;

Discussion

This notification’s object is the saved context. Don’t peform any asynchronous work or block the calling thread. NSManagedObjectContext posts notifications to the same thread that creates it.

The userInfo dictionary contains the inserted, updated, and deleted managed objects of the completed save. For the keys to access those objects, see NSManagedObjectContext.NotificationKey. Don’t capture the dictionary’s contents.

To safely use the provided managed objects on the current thread, create a new context and use its mergeChanges(fromContextDidSave:) method to merge in the notification’s changes.