initWithTarget:selector:object:
Returns an NSInvocationOperation object initialized with the specified target and selector.
Declaration
- (instancetype) initWithTarget:(id) target selector:(SEL) sel object:(id) arg;Parameters
- target:
The object defining the specified selector.
- sel:
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 must be
id. The return type of the method may bevoid, a scalar value, or an object that can be returned as anidtype. - arg:
The parameter object to pass to the selector. If the selector does not take an argument, specify
nil.
Return Value
An initialized NSInvocationOperation object or nil if the target object does not implement the specified selector.
Discussion
If you specify a selector with a non-void return type, you can get the return value by calling the result method after the operation finishes executing. The receiver tells the invocation object to retain its arguments.
See Also
Related Documentation
- Threading Programming Guide