Up

# NSMethodSignature class reference

### Authors

Andrew Kachites McCallum (`mccallum@gnu.ai.mit.edu`)

Copyright: (C) 1994-2015 Free Software Foundation, Inc.

# Software documentation for the NSMethodSignature class

## NSMethodSignature : NSObject

> Declared in:
>   Foundation/NSMethodSignature.h

Availability: OpenStep

Class encapsulating type information for method arguments and return value. It is used as a component of NSInvocation to implement message forwarding, such as within the distributed objects framework. Instances can be obtained from the NSObject method [NSObject -methodSignatureForSelector:] .

Basically, types are represented as Objective-C `@encode(...)` compatible strings. The arguments are numbered starting from 0, including the implicit arguments `self` (type `id`, at position 0) and `_cmd` (type `SEL`, at position 1).

Method summary

- +signatureWithObjCTypes:
- -frameLength
- -getArgumentTypeAtIndex:
- -isOneway
- -methodReturnLength
- -methodReturnType
- -numberOfArguments

### signatureWithObjCTypes:

+ (NSMethodSignature*) signatureWithObjCTypes: (const char*)t;
Availability: OpenStep
Build a method signature directly from string description of return type and argument types, using the Objective-C `@encode(...)` type codes.

### frameLength

- (NSUInteger) frameLength;
Availability: OpenStep
Number of bytes that the full set of arguments occupies on the stack, which is platform(hardware)-dependent.

### getArgumentTypeAtIndex:

- (const char*) getArgumentTypeAtIndex: (NSUInteger)index;
Availability: OpenStep
Returns Objective-C `@encode(...)` compatible string. Arguments are numbered starting from 0, including the implicit arguments `self` (type `id`, at position 0) and `_cmd` (type `SEL`, at position 1).
Type strings may include leading type qualifiers.

### isOneway

- (BOOL) isOneway;
Availability: OpenStep
Pertains to distributed objects; method is asynchronous when invoked and return should not be waited for.

### methodReturnLength

- (NSUInteger) methodReturnLength;
Availability: OpenStep
Number of bytes that the return value occupies on the stack, which is platform(hardware)-dependent.

### methodReturnType

- (const char*) methodReturnType;
Availability: OpenStep
Returns an Objective-C `@encode(...)` compatible string describing the return type of the method. This may include type qualifiers.

### numberOfArguments

- (NSUInteger) numberOfArguments;
Availability: OpenStep
Returns number of arguments to method, including the implicit `self` and `_cmd`.

Up