Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/Foundation.framework |
Availability | Available in Mac OS X v10.5 and later. |
Companion guide | |
Declared in | NSOperation.h |
The NSInvocationOperation
class is a concrete subclass of NSOperation
that manages the execution of a single encapsulated task specified as an invocation. You can use this class to initiate an operation that consists of invoking a selector on a specified object. This class implements a non-concurrent operation.
For more information on concurrent versus non-concurrent operations, see NSOperation Class Reference.
Returns an NSInvocationOperation
object initialized with the specified invocation object.
- (id)initWithInvocation:(NSInvocation *)inv
The invocation object identifying the target object, selector, and parameter objects.
An initialized NSInvocationOperation
object or nil
if the object could not be initialized.
This method is the designated initializer. The receiver tells the invocation object to retain its arguments.
NSOperation.h
Returns an NSInvocationOperation
object initialized with the specified target and selector.
- (id)initWithTarget:(id)target selector:(SEL)sel object:(id)arg
The object defining the specified selector.
The selector to invoke when running the operation. The selector may take 0 or 1 parameters. If it accepts a parameter, the type of that parameter should be id
.
The parameter object to pass to the selector. If the selector does not take an argument, specify nil
.
An initialized NSInvocationOperation
object or nil
if the target object does not implement the specified selector.
NSOperation.h
Returns the receiver’s invocation object.
- (NSInvocation *)invocation
The invocation object identifying the target object, selector, and parameters to use to execute the operation’s task.
NSOperation.h
Returns the result of the invocation or method.
- (id)result
The object returned by the method or an NSValue
object containing the return value if it is not an object. If the method or invocation is not finished executing, this method returns nil
.
If an exception was raised during the execution of the method or invocation, this method raises that exception again. If the operation was cancelled or the invocation or method has a void
return type, calling this method raises an exception; see “Result Exceptions”
.
NSOperation.h
Names of exceptions raised by NSInvocationOperation
if there is an error when calling the result
method.
extern NSString * const NSInvocationOperationVoidResultException; extern NSString * const NSInvocationOperationCancelledException;
NSInvocationOperationVoidResultException
The name of the exception raised if the result
method is called for an invocation method with a void
return type.
Available in Mac OS X v10.5 and later.
Declared in NSOperation.h
.
NSInvocationOperationCancelledException
The name of the exception raised if the result
method is called after the operation was cancelled.
Available in Mac OS X v10.5 and later.
Declared in NSOperation.h
.
NSOperation.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-12)