Attempts to commit unsaved changes to registered objects to the context’s parent store.
- iOS 3.0+
- macOS 10.4+
- tvOS 9.0+
- watchOS 2.0+
- Core Data
A pointer to an
NSErrorobject. You do not need to create an
NSErrorobject. The save operation aborts after the first failure if you pass
true if the save succeeds, otherwise
If there were multiple errors (for example several edited objects had validation failures) the description of
NSError returned indicates that there were multiple errors, and its userInfo dictionary contains the key
NSDetailed. The value associated with the
NSDetailed key is an array that contains the individual
If a context’s parent store is a persistent store coordinator, then changes are committed to the external store. If a context’s parent store is another managed object context, then
save() only updates managed objects in that parent store. To commit changes to the external store, you must save changes in the chain of contexts up to and including the context whose parent is the persistent store coordinator.