---
title: retainArguments
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/nsinvocation/retainarguments
---

# retainArguments

If the receiver hasn’t already done so, retains the target and all object arguments of the receiver and copies all of its C-string arguments and blocks. If a returnvalue has been set, this is also retained or copied.

## Declaration

```occ
- (void) retainArguments;
```

## Discussion

Discussion Before this method is invoked, argumentsRetained returns false; after, it returns true. For efficiency, newly created NSInvocation objects don’t retain or copy their arguments, nor do they retain their targets, copy C strings, or copy any associated blocks. You should instruct an NSInvocation object to retain its arguments if you intend to cache it, because the arguments may otherwise be released before the invocation is invoked. NSTimer objects always instruct their invocations to retain their arguments, for example, because there’s usually a delay before a timer fires.

## See Also

### Configuring an Invocation Object

- [selector](foundation/nsinvocation/selector.md)
- [target](foundation/nsinvocation/target.md)
- [setArgument:atIndex:](foundation/nsinvocation/setargument:atindex:.md)
- [getArgument:atIndex:](foundation/nsinvocation/getargument:atindex:.md)
- [argumentsRetained](foundation/nsinvocation/argumentsretained.md)
- [setReturnValue:](foundation/nsinvocation/setreturnvalue:.md)
- [getReturnValue:](foundation/nsinvocation/getreturnvalue:.md)
