Instance Method


Recursively writes the entire contents of a file wrapper to a given file-system URL.


- (BOOL)writeToURL:(NSURL *)url options:(NSFileWrapperWritingOptions)options originalContentsURL:(NSURL *)originalContentsURL error:(NSError * _Nullable *)outError;



URL of the file-system node to which the file wrapper’s contents are written.


Option flags for writing to the node located at url. See NSFileWrapperWritingOptions for possible values.


The location of a previous revision of the contents being written. The default implementation of this method attempts to avoid unnecessary I/O by writing hard links to regular files instead of actually writing out their contents when the contents have not changed. The child file wrappers must return accurate values when its filename property is accessed for this to work. Use the NSFileWrapperWritingWithNameUpdating writing option to increase the likelihood of that.

Specify nil for this parameter if there is no earlier version of the contents or if you want to ensure that all the contents are written to files.


If an error occurs, upon return contains an NSError object that describes the problem. Pass NULL if you do not want error information.

Return Value

YES when the write operation is successful. If not successful, returns NO after setting outError to an NSError object that describes the reason why the file wrapper’s contents could not be written.


See Also

Writing Files

- writeToFile:atomically:updateFilenames:

Writes a file wrapper’s contents to a given file-system node.