Instance Method

getArgument:atIndex:

Returns by indirection the receiver's argument at a specified index.

Declaration

- (void)getArgument:(void *)argumentLocation atIndex:(NSInteger)idx;

Parameters

buffer

An untyped buffer to hold the returned argument. See the discussion below relating to argument values that are objects.

index

An integer specifying the index of the argument to get.

Indices 0 and 1 indicate the hidden arguments self and _cmd, respectively; these values can be retrieved directly with the target and selector methods. Use indices 2 and greater for the arguments normally passed in a message.

Discussion

This method copies the argument stored at index into the storage pointed to by buffer. The size of buffer must be large enough to accommodate the argument value.

When the argument value is an object, pass a pointer to the variable (or memory) into which the object should be placed:

NSArray *anArray;
[invocation getArgument:&anArray atIndex:3];

This method raises NSInvalidArgumentException if index is greater than the actual number of arguments for the selector.

See Also

Configuring an Invocation Object

selector

The receiver’s selector, or 0 if it hasn’t been set.

target

The receiver’s target, or nil if the receiver has no target.

- setArgument:atIndex:

Sets an argument of the receiver.

argumentsRetained

YES if the receiver has retained its arguments, NO otherwise.

- 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.

- setReturnValue:

Sets the receiver’s return value.

- getReturnValue:

Gets the receiver's return value.