Writes the document data to disk at the sandbox location indicated by a file URL.
- iOS 5.0+
If the object encapsulating the document data is of some other type, you should override this method or
writeto perform the actual writing of the data.
Contents(_: and Attributes: safely To: for:)
A file URL specifying the location of the document file in the application sandbox.
A constant that indicates whether the document file is being written the first time or whether it is being overwritten. See
A file URL specifying the previous location of the document file (if not
If you override this method and cannot write the document data for any reason, return by indirection an
NSErrorobject that encapsulates the reasons why you can’t. Otherwise, ignore this parameter.
true if the write operation succeeds, otherwise
This method is called by the
write to write the actual file data. It is passed the contents object returned from your
contents(for implementation. The default implementation of this method supports
File contents by asking the contents object to save itself to the corresponding URL.
If you override this method, you may choose to return a different type of data from
contents(for or you may choose to not override
contents(for and generate the writable data directly within this method. If you override this method, you should not invoke the superclass implementation.