NSBlockOperation Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in iOS 4.0 and later. |
| Companion guide | |
| Declared in | NSOperation.h |
Overview
The NSBlockOperation class is a concrete subclass of NSOperation that manages the concurrent execution of one or more blocks. You can use this object to execute several blocks at once without having to create separate operation objects for each. When executing more than one block, the operation itself is considered finished only when all blocks have finished executing.
Blocks added to a block operation are dispatched with default priority to an appropriate work queue. The blocks themselves should not make any assumptions about the configuration of their execution environment.
For more information about blocks, see Blocks Programming Topics.
Class Methods
blockOperationWithBlock:
Creates and returns an NSBlockOperation object and adds the specified block to it.
Parameters
- block
The block to add to the new block operation object’s list. The block should take no parameters and have no return value.
Return Value
A new block operation object.
Availability
- Available in iOS 4.0 and later.
Declared In
NSOperation.hInstance Methods
addExecutionBlock:
Adds the specified block to the receiver’s list of blocks to perform.
Parameters
- block
The block to add to the receiver’s list. The block should take no parameters and have no return value.
Discussion
The specified block should not make any assumptions about its execution environment.
Calling this method while the receiver is executing or has already finished causes an NSInvalidArgumentException exception to be thrown.
Availability
- Available in iOS 4.0 and later.
Declared In
NSOperation.hexecutionBlocks
Returns an array containing the blocks associated with the receiver.
Return Value
An array of blocks. The blocks in this array are copies of the ones originally added using the addExecutionBlock: method.
Availability
- Available in iOS 4.0 and later.
Declared In
NSOperation.h© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-04-13)