Saves the contents of the document to a file or file package located by a URL, formatted to a specified type, for a particular kind of save operation, and invokes the passed-in completion handler.
- macOS 10.7+
The location to which the document contents are written.
The document type.
The type of save operation.
The completion handler block object passed in to be invoked at some point in the future, perhaps after the method invocation has returned. The completion handler must be invoked on the main thread.
The block takes one argument:
If successful, pass a
nilerror. If not successful, pass an
NSErrorobject that encapsulates the reason why the document could not be saved.
The default implementation of this method invokes
can. If writing can’t be done concurrently, it invokes
write on the main thread thread. If writing can be done concurrently, it invokes that method on a different thread, but blocks the main thread until something invokes
unblock. Either way, if
YES, it updates the values in the
autosaved properties and calls the
update method as appropriate on the main thread. It also updates information that
save uses to check for modification, renaming, moving, deleting, and trashing of open documents, and deletes autosaved contents files when they have become obsolete. You can override this method to do things that need to be done before or after any save operation but be sure to invoke
For backward binary compatibility with OS X v10.6 and earlier, the default implementation of this method instead invokes
save if that method is overridden and this one is not, and it passes any error to the completion handler.