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

# setReturnValue:

Sets the receiver’s return value.

```
- (void) setReturnValue:(void *) retLoc;
```

## Parameters

`retLoc`

An untyped buffer whose contents are copied as the receiver’s return value.

## Discussion

This value is normally set when you send an [`invoke`](/documentation/Foundation/NSInvocation/invoke) or [`invokeWithTarget:`](/documentation/Foundation/NSInvocation/invokeWithTarget:) message.

## See Also

[`@property (readonly) NSUInteger methodReturnLength;`](/documentation/Foundation/NSMethodSignature/methodReturnLength)

The number of bytes required for the return value.

[`@property (readonly) const char * methodReturnType;`](/documentation/Foundation/NSMethodSignature/methodReturnType)

A C string encoding the return type of the method in Objective-C type encoding.



---

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)