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

# methodSignatureForSelector:

Raises `NSInvalidArgumentException`. Override this method in your concrete subclass to return a proper `NSMethodSignature` object for the given selector and the class your proxy objects stand in for.

```
- (NSMethodSignature *) methodSignatureForSelector:(SEL) sel;
```

## Parameters

`sel`

The selector for which to return a method signature.

## Return Value

Not applicable. The implementation provided by `NSProxy` raises an exception.

## Discussion

Be sure to avoid an infinite loop when necessary by checking that `sel` isn’t the selector for this method itself and by not sending any message that might invoke this method.

For example, if your proxy merely forwards messages to an instance variable named `realObject`, it can implement [`methodSignatureForSelector:`](/documentation/Foundation/NSProxy/methodSignatureForSelector:) like this:

```objc
– (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
    return [realObject methodSignatureForSelector:aSelector];
}
```

## See Also

  <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/methodSignatureForSelector:>



---

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)