Creates a version of the file at the specified location.
- macOS 10.7+
The location at which to store the new file version.
The URL that specifies the file to use for the version contents.
Specify 0 for this parameter if you want to create a copy of the file at the location specified by the
urlparameter. Alternatively, specify one of the constants described in
Version .Adding 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 file version object representing the new version or
nil if an error occurred.
You can use this method to save a version of your file to the location specified by the
url parameter. The contents of the file are taken from the
contents parameter, whose value may be the same as the
You should always add file versions as part of a coordinated write operation to a file. In other words, always call this method from a block passed to a file coordinator object to initiate a write operation. Doing so ensures that no other processes are operating on the file while you save the version to its new location.