---
title: "initWithTarget:selector:object:"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsinvocationoperation/initwithtarget:selector:object:"
---

# initWithTarget:selector:object:

Returns an NSInvocationOperation object initialized with the specified target and selector.

## Declaration

```occ
- (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 be void, a scalar value, or an object that can be returned as an id type.
- `arg`: The parameter object to pass to the selector. If the selector does not take an argument, specify nil.

## Return Value

Return Value An initialized NSInvocationOperation object or nil if the target object does not implement the specified selector.

## Discussion

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](apple-archive/documentation/Cocoa/Conceptual/Multithreading/Introduction.md)

### Initialization

- [initWithInvocation:](foundation/nsinvocationoperation/initwithinvocation:.md)
