Instance Method


Override this method to load the document data into the app’s data model.


- (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError * _Nullable *)outError;



An object encapsulating the document data to load. This object is either an instance of the NSData class (for flat files) or the NSFileWrapper class (for file packages).


The file type of the document, a Uniform Type Identifier (UTI) based on the file extension of fileURL. You can obtain the default value of the file type from the fileType property.


If you cannot load the document data for any reason, return by indirection an NSError object that encapsulates the reasons you can’t. Otherwise, ignore this parameter.

Return Value

YES if you successfully load the document, NO otherwise.


Override this method to accept and load the data for a document. After UIDocument reads the document data from the file located at fileURL it calls your subclass, passing the data to the subclass in this method. This method is called on the queue that the openWithCompletionHandler: method was called on (typically, the main queue).

See Also

Reading Document Data


Opens a document asynchronously.


Reads the document data in a file at a specified location in the application sandbox.