Instance Method


Attempt to commit pending edits, returning an error in the case of failure.


- (BOOL)commitEditingAndReturnError:(NSError * _Nullable *)error;



If an error occurs during the commit operation, upon returns contains an NSError object that describes the problem.

Return Value

YES if the commit is successful, otherwise NO.


During autosaving, commit editing may fail, due to a pending edit. Rather than interrupt the user with an unexpected alert, this method provides the caller with the option to either present the error or fail silently, leaving the pending edit in place and the user's editing uninterrupted. In your implementation of this method, you should attempt to commit editing, but if there is a failure return NO and in error an error object to be presented or ignored as appropriate.

See Also

Managing Editing

- discardEditing

Causes the receiver to discard any changes, restoring the previous values.

- commitEditing

Returns whether the receiver was able to commit any pending edits.

- commitEditingWithDelegate:didCommitSelector:contextInfo:

Attempt to commit any currently edited results of the receiver.