<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSInvocation/retainArguments",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSInvocation(im)retainArguments"
  },
  "title" : "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.

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

## Discussion

Before this method is invoked, [`argumentsRetained`](/documentation/Foundation/NSInvocation/argumentsRetained) returns <doc://com.apple.documentation/documentation/Swift/false>; after, it returns <doc://com.apple.documentation/documentation/Swift/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)