Creates a new document by reading the contents for the document from another URL, presents its user interface, and returns the document if successful.
- macOS 10.7+
The URL locating the document from which contents of the new document are copied.
YES, the contents located at the passed-in URL are copied into a file located in the directory used for the autosaved contents of untitled documents.
nilthen this value is used to derive a display name for the new document that does not match one that is already in use by an open document.
On return, if duplication is unsuccessful, a pointer to an error object that encapsulates the reason the document could not be created.
The newly created
NSDocument object, or
nil if the document could not be created.
The default implementation of this method copies the file if specified, determines the type of the document, calls
make to instantiate it, sends the document
set to name it if
display is not
add to record its opening, and sends the document
The default implementation of this method uses the file coordination mechanism introduced in OS X v10.7. It passes the document to the
add immediately after calling the
add method. (The balancing invocation of the
remove is in the
You can override this method to customize how documents are duplicated. It is called by the
duplicate. It may also be called from other places in AppKit.
In most cases, an app does not need to call this method directly.