Instance Method

unblockUserInteraction

Unblocks the main thread during asynchronous saving.

Declaration

- (void)unblockUserInteraction;

Discussion

If saveToURL:ofType:forSaveOperation:completionHandler: is writing on a non-main thread because canAsynchronouslyWriteToURL:ofType:forSaveOperation: has returned YES, but it is still blocking the main thread, this method unblocks the main thread. Otherwise, it does nothing. For example, the default implementation of fileWrapperOfType:error: invokes this when it has created the NSFileWrapper object to return. Assuming that the NSFileWrapper is not mutated by subsequent user actions, it is effectively a "snapshot" of the document’s contents, and once it is created it is safe to resume handling user events on the main thread, even though some of those user events might change the document’s contents before the NSFileWrapper object has been safely written. You can invoke this method to make asynchronous saving actually asynchronous if you’ve overridden writeSafelyToURL:ofType:forSaveOperation:error:, writeToURL:ofType:forSaveOperation:originalContentsURL:error:, or writeToURL:ofType:error: in such a way that the invocation of this method done by the writeToURL:ofType:error: default implementation won’t happen during writing.

See Also

Writing the Document's Content

- canAsynchronouslyWriteToURL:ofType:forSaveOperation:

Returns whether the receiver can concurrently write to a file or file package located by a URL, that is formatted for a specific type, for a specific kind of save operation.

- writeToURL:ofType:error:

Writes the contents of the document to a file or file package located by a URL, that is formatted to a specified type.

- writeSafelyToURL:ofType:forSaveOperation:error:

Writes the contents of the document to a file or file package located by a URL.

- fileWrapperOfType:error:

Creates and returns a file wrapper that contains the contents of the document, formatted to the specified type.

- dataOfType:error:

Creates and returns a data object that contains the contents of the document, formatted to a specified type.

- writeToURL:ofType:forSaveOperation:originalContentsURL:error:

Writes the contents of the document to a file or file package located by a URL.

- saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:

Saves the contents of the document to a file or file package located by a URL, that is formatted to a specified type, for a particular kind of save operation.

- saveToURL:ofType:forSaveOperation:completionHandler:

Saves the contents of the document to a file or file package located by a URL, that is formatted to a specified type, for a particular kind of save operation, and invokes the passed-in completion handler.

- fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:

Returns the attributes to write to the file or file package at the specified URL, and targeting the specified type of save operation.

NSSaveOperationType

Constants for specifying the type of document-save operation to perform.