Instance Method

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.

Declaration

- (BOOL)canAsynchronouslyWriteToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation;

Parameters

url

The location of the file or package to which the document is written.

typeName

The string that identifies the document type.

saveOperation

The type of save operation.

Return Value

NO by default; subclasses can override to return YES, thereby enabling asynchronous writing.

Discussion

The default implementation of this method returns NO. You are strongly encouraged to override it and make it return YES, after making sure your overrides of document writing methods can be safely invoked on a non-main thread, and making sure that the unblockUserInteraction method is invoked at some appropriate time during writing.

See Also

Writing the Document's Content

- unblockUserInteraction

Unblocks the main thread during asynchronous saving.

- 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.