Instance Method


Sets the contents of this document by reading from data of a specified type and returns YES if successful.


- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError * _Nullable *)outError;



The data object from which the document contents are read.


The string that identifies the document type.


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.


The default implementation of this method throws an exception because at least one of the three reading methods (this method, readFromURL:ofType:error:, readFromFileWrapper:ofType:error:), or every method that may invoke readFromURL:ofType:error:, must be overridden.

See Also

Loading Document Data

- dataOfType:error:

Creates and returns a data object that contains the contents of the document, formatted to a specified type.

- fileWrapperOfType:error:

Creates and returns a file wrapper that contains the contents of the document, formatted to the specified type.


A Boolean value indicating whether the document’s file is completely loaded into memory.