Replace the contents of the specified file with the contents of the current version’s file.
- iOS 5.0+
- macOS 10.7+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The file whose contents you want to replace. If the file at this URL does not exist, a new file is created at the location.
0to overwrite the file in place; otherwise, specify one of the constants described in
Version .Replacing Options
On input, a pointer to an error object. If an error occurs, this pointer is set to an
NSErrorobject with information about the error.
The URL of the file that was written, which may be different than the one specified in the
When replacing the contents of the file, this method does not normally replace the display name associated with the file. The only exception is when the file at
url is of a different type than the file associated with this version object. In such a case, the file name remains the same but its filename extension changes to match the type of the new contents. (Of course, if filename extension hiding is enabled, this change is not noticeable to users.)