Instance Method


Waits for any scheduled file access to complete but without blocking the main thread, then invokes the passed-in block.


- (void)performAsynchronousFileAccessUsingBlock:(void (^)(void (^fileAccessCompletionHandler)(void)))block;



A block that performs file access.


This method does the same sort of work as performSynchronousFileAccessUsingBlock:, but without ever blocking the main thread, and may not invoke the block until after the method invocation has returned, though still always on the same thread as the method invocation. The block is passed another block, the file access completion handler, which must be invoked when the file access is complete, though it can be invoked from any thread. This method is for use with file access that might begin on one thread but continue on another before it is complete. For example, saveToURL:ofType:forSaveOperation:completionHandler: uses this method instead of performSynchronousFileAccessUsingBlock: because if it does asynchronous saving then there is no way for it to complete all of its file access before returning from the file access block.

See Also

Performing Tasks Serially

- performSynchronousFileAccessUsingBlock:

Waits for any scheduled file access to complete, then invokes the passed-in block.

- performActivityWithSynchronousWaiting:usingBlock:

Waits for any work scheduled by previous invocations of this method to complete, then invokes the passed-in block.

- continueActivityUsingBlock:

Continues to perform the task for a user activity object using a different block.

- continueAsynchronousWorkOnMainThreadUsingBlock:

Invokes the passed-in block on the main thread.