Override this method to return the document data to be saved.
- iOS 5.0+
- Mac Catalyst 13.0+
If you cannot return document data, return by indirection an
NSErrorobject that encapsulates the reasons you can’t. Otherwise, ignore this parameter.
The document data to be saved, or
nil if you cannot return document data. The returned object is typically an instance of the
NSData class for flat files or the
File class for file packages. If you return
nil, you should also return an error object in
If you return an object other than an
File object, you must override the
write method to handle the writing of data.
When you subclass
UIDocument, override this method to provide UIKit with the document data for saving.
This method is called on the queue that the
save(to: method was called on (typically, the main queue). Writing of data occurs on a background queue. The default implementation of this method returns
When you return a non-
nil value in the
out parameter, the completion handlers for the following methods do not get called:
If you want more control over the saving operation than this method provides—for example, if you want to perform incremental writing of data—override, instead, one of the lower-level data-writing methods such as
write. These methods are called on a background thread.