Sets the contents of this document by reading from a file or file package, of a specified type, located by a URL.
SDK
- macOS 10.4+
Framework
- App
Kit
Declaration
Parameters
absoluteURL
The location from which the document contents are read.
typeName
The string that identifies the document type.
outError
On return, if the document contents could not be read, a pointer to an error object that encapsulates the reason they could not be read.
Return Value
true
if the document contents could be read; otherwise, false
.
Discussion
The default implementation of this method just creates an NSFileWrapper and invokes [self read
.
For backward binary compatibility with OS X v10.3 and earlier, the default implementation of this method instead invokes [self read
if read
is overridden and the URL uses the file:
scheme.
Handling Errors in Swift:
In Swift, this method is marked with the throws
keyword to indicate that it throws an error in cases of failure.
When overriding this method, use the throw
statement to throw an NSError
, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.