<!--
{
  "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/invocationWithMethodSignature:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSInvocation(cm)invocationWithMethodSignature:"
  },
  "title" : "invocationWithMethodSignature:"
}
-->

# invocationWithMethodSignature:

Returns an `NSInvocation` object able to construct messages using a given method signature.

```
+ (NSInvocation *) invocationWithMethodSignature:(NSMethodSignature *) sig;
```

## Parameters

`sig`

An object encapsulating a method signature.

## Discussion

The new object must have its selector set with [`NSInvocation`](/documentation/Foundation/NSInvocation) and its arguments set with [`setArgument:atIndex:`](/documentation/Foundation/NSInvocation/setArgument:atIndex:) before it can be invoked. Do not use the <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/alloc>/<doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/init()> approach to create `NSInvocation` objects.

## See Also

  [Distributed Objects Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DistrObjects/DistrObjects.html#//apple_ref/doc/uid/10000102i)



---

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)