Writes the contents of the document to a file or file package located by a URL.
- macOS 10.4+
The location to which the document contents are written.
The string that identifies the document type.
The type of save operation.
On return, if the document contents could not be written, a pointer to an error object that encapsulates the reason they could not be written.
YES if the document contents could be written; otherwise,
The default implementation of this method invokes
write. It also invokes
file and writes the returned attributes, if any, to the file. It may copy some attributes from the old on-disk revision of the document at the same time, if applicable.
This method is responsible for doing document writing in a way that minimizes the danger of leaving the disk to which writing is being done in an inconsistent state in the event of an app crash, system crash, hardware failure, power outage, and so on. If you override this method, be sure to invoke the superclass implementation.
NSSave, the default implementation of this method uses the value in the
keep property to determine whether or not the old on-disk revision of the document, if there was one, should be preserved after being renamed.
For backward binary compatibility with OS X v10.3 and earlier, the default implementation of this method instead invokes
write if that method is is overridden and the URL uses the
file: scheme. The save operation in this case is never
NSSave is used instead.