Instance Method

readFromURL:ofType:error:

Sets the contents of this document by reading from a file or file package, of a specified type, located by a URL.

Declaration

- (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)typeName error:(NSError * _Nullable *)outError;

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

YES if the document contents could be read; otherwise, NO.

Discussion

The default implementation of this method just creates an NSFileWrapper and invokes [self readFromFileWrapper:theFileWrapper ofType:typeName error:outError].

For backward binary compatibility with OS X v10.3 and earlier, the default implementation of this method instead invokes [self readFromFile:[absoluteURL path] ofType:typeName] if readFromFile:ofType: is overridden and the URL uses the file: scheme.

See Also

Reading the Document's Content

+ canConcurrentlyReadDocumentsOfType:

Returns a Boolean value that indicates whether the receiver reads multiple documents of the given type concurrently.

- readFromFileWrapper:ofType:error:

Sets the contents of this document by reading from a file wrapper of a specified type.

- readFromData:ofType:error:

Sets the contents of this document by reading from data of a specified type.