Instance Method

removeAndReturnError:

Remove this version object and its associated file from the version store.

Declaration

- (BOOL)removeAndReturnError:(NSError * _Nullable *)outError;

Parameters

outError

On input, a pointer to an error object. If an error occurs, this pointer is set to an NSError object with information about the error.

Return Value

YES if this version was removed successfully or NO if it was not.

Discussion

This method removes this version object and its file from the version store, freeing up the associated storage space. You must not call this method for the current file version—that is, the version object returned by the currentVersionOfItemAtURL: method.

You should always remove 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 remove the version information.

If successful, subsequent requests for the versions of the file do not include this version object (or any object with the same information). You can use this method to free up disk space by removing versions that are no longer needed.

See Also

Replacing and Deleting Versions

- replaceItemAtURL:options:error:

Replace the contents of the specified file with the contents of the current version’s file.

+ removeOtherVersionsOfItemAtURL:error:

Removes all versions of a file, except the current one, from the version store.