Instance Method

getReturnValue:

Gets the receiver's return value.

Declaration

- (void)getReturnValue:(void *)retLoc;

Parameters

buffer

An untyped buffer into which the receiver copies its return value. It should be large enough to accommodate the value. See the discussion below for more information about buffer.

Discussion

Use the NSMethodSignature method methodReturnLength to determine the size needed for buffer:

NSUInteger length = [[myInvocation methodSignature] methodReturnLength];
buffer = (void *)malloc(length);
[invocation getReturnValue:buffer];

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

id anObject;
NSArray *anArray;
[invocation1 getReturnValue:&anObject];
[invocation2 getReturnValue:&anArray];

If the NSInvocation object has never been invoked, the result of this method is undefined.

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.

- getArgument:atIndex:

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

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.