<!--
{
  "availability" : [
    "iOS: 15.4.0 -",
    "iPadOS: 15.4.0 -",
    "macCatalyst: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StoreKitTest",
  "identifier" : "/documentation/StoreKitTest/SKAdTestSession/setPostbacks(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "StoreKit Test"
    ],
    "preciseIdentifier" : "c:objc(cs)SKAdTestSession(im)setPostbacks:error:"
  },
  "title" : "setPostbacks(_:)"
}
-->

# setPostbacks(_:)

Add test postbacks to the test session.

```
func setPostbacks(_ postbacks: [SKAdTestPostback]) throws
```

## Parameters

`postbacks`

An array of one to six test postbacks you add to a test session. The first postback must always be the winning postback with a `didWin` value of `true`. There must be only one winning postback.

## Discussion

An error occurs if any of the test postbacks are invalid or if there’s an issue with the set of test postbacks. Otherwise, the test passes.

Create postbacks using the initializer for [`SKAdTestPostback`](/documentation/StoreKitTest/SKAdTestPostback), [`init(version:adNetworkIdentifier:adCampaignIdentifier:appStoreItemIdentifier:sourceAppStoreItemIdentifier:conversionValue:fidelityType:isRedownload:didWin:postbackURL:)`](/documentation/StoreKitTest/SKAdTestPostback/init(version:adNetworkIdentifier:adCampaignIdentifier:appStoreItemIdentifier:sourceAppStoreItemIdentifier:conversionValue:fidelityType:isRedownload:didWin:postbackURL:)). Add the postbacks to the test session by calling [`setPostbacks(_:)`](/documentation/StoreKitTest/SKAdTestSession/setPostbacks(_:)).

Calling [`setPostbacks(_:)`](/documentation/StoreKitTest/SKAdTestSession/setPostbacks(_:)) overwrites previous postbacks in the test session, if any exist.

Include up to six test postbacks in your test session if you want to mimic the behavior of postbacks when users experience multiple ad impressions for the same app. For more information about attributions when there are multiple ad impressions, see <doc://com.apple.documentation/documentation/StoreKit/receiving-ad-attributions-and-postbacks>.

The array of test postbacks in the test session need to follow the same rules that SKAdNetwork uses for postbacks, including:

- The `postbacks` array can only contain up to six postbacks.
- The first postback in the array must be the only winning postback in the array, with a `didWin` value of `true`.
- All postbacks, except the first postback in the array, have a `didWin` value of `false`.

---

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)