Instance Method

openDocumentWithContentsOfURL:display:error:

Opens a document located by the given URL presents its user interface if requested, and returns the document if successful.

Declaration

- (id)openDocumentWithContentsOfURL:(NSURL *)url display:(BOOL)displayDocument error:(NSError * _Nullable *)outError;

Discussion

If not successful, the method returns nil after setting outError to point to an NSError object that encapsulates the reason why the document could not be opened.

The default implementation of this method checks to see if the document is already open according to documentForURL:, and if it is not open determines the type of the document, calls makeDocumentWithContentsOfURL:ofType:error: to instantiate it, then calls addDocument: to record its opening, and sends the document makeWindowControllers and showWindows messages if displayDocument is YES. If the document is already open it is just sent a showWindows message if displayDocument is YES.

See Also

Deprecated Methods

- documentForFileName:

Returns the document object for the file in which the document data is stored.

Deprecated
- fileExtensionsFromType:

Returns the allowable file extensions for the given document type.

Deprecated
- fileNamesFromRunningOpenPanel

Returns a selection of files chosen by the user in the Open panel.

Deprecated
- makeUntitledDocumentOfType:

Creates and returns a document object for document type.

Deprecated
- makeDocumentWithContentsOfURL:ofType:

Creates and returns a document object for the given document type from the contents of a given URL.

Deprecated
- makeDocumentWithContentsOfFile:ofType:

Creates and returns a document object of a given document type from the contents of a file.

Deprecated
- openDocumentWithContentsOfFile:display:

Returns a document object created from the contents of a given file and optionally displays it.

Deprecated
- openDocumentWithContentsOfURL:display:

Returns a document object created from the contents of a given URL and optionally displays it.

Deprecated
- openUntitledDocumentOfType:display:

Returns a document object instantiated from the subclass of the given document type and optionally displays it.

Deprecated
- reopenDocumentForURL:withContentsOfURL:error:

Reopens an autosaved document located by a URL, by reading the contents for the document from another URL, presents its user interface, and returns YES if successful.

Deprecated
- setShouldCreateUI:

Sets whether the window controllers of a document should be created when the document is created.

Deprecated
- shouldCreateUI

Returns a Boolean value that indicates whether the window controllers of a document should be created when the document is created.

Deprecated
- typeFromFileExtension:

Returns the document type associated with files having extension fileExtensionOrHFSFileType.

Deprecated