Ensures that document data is written safely to a specified location in the application sandbox.
- 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(_: to: for: original Contents URL:)
The 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
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.
This method is called by the
save(to: method to save the file data (and associated attributes in the case of an
File). It creates temporary files and directories as necessary so that successful saves can be completed atomically and failed saves can be rolled back cleanly. This method calls
write to save the
contents object, passing the location for the new saved file in the
to parameter and the location of the previously existing file in the
original parameter, if this is an overwrite operation.
If you want to change how file data is saved, you generally override the
write method instead of this method. Additionally, you don’t need to call this method directly unless you are overriding the