# iOS

## 1. Integration

{% hint style="warning" %}
**Before you start**&#x20;

To set up the PubScale Offerwall, you’ll need to add your app to our platform. Follow this guide for instructions on [how to set up your app](https://pubscale.gitbook.io/offerwall-sdk/1.0.10/basic-integration/setting-up-your-app). Once completed, you will receive a unique 8-digit app ID.
{% endhint %}

<figure><picture><source srcset="https://content.gitbook.com/content/wtFu5cQcg9ZXDSngP2aN/blobs/pZAkfHGAYoKlDM5kK29m/wow_flow_dark.png" media="(prefers-color-scheme: dark)"><img src="https://content.gitbook.com/content/wtFu5cQcg9ZXDSngP2aN/blobs/LswXTxEAv7IAMykYqwhk/Wow_flow%20(1).png" alt=""></picture><figcaption></figcaption></figure>

To integrate the PubScale Offerwall, you need to construct a URL and provide a set of  parameters for proper configuration.

**Construct the Offerwall URL**

<pre class="language-html"><code class="lang-html"><strong>https://wow.pubscale.com?app_id={app_id}&#x26;user_id={user_id}&#x26;idfa={idfa}
</strong></code></pre>

&#x20;**Parameters**

| Parameters                          | Description                                                                                                                                                            |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **app\_id** (Required)              | This is the unique identifier for your app, required for integration.                                                                                                  |
| **user\_id** (Required)             | A unique identifier for each user, required to track their activity on the offerwall. We recommend using a UUID as the user\_id.                                       |
| **idfa** (Optional but Recommended) | For iOS integrations Include the **idfa** as a parameter when launching the  Offerwall. This helps enhance tracking accuracy and plays a key role in fraud prevention. |

To integrate the PubScale Offerwall into your iOS App, you have the following options:

### Using SFSafariViewController:&#x20;

For optimal performance and user experience, we recommend launching the Offerwall using `SFSafariViewController`&#x20;

Here's a simple Swift example that opens PubScale Offerwall in a `SFSafariViewController` on iOS

```swift
import UIKit
import SafariServices

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        openLinkInSafariViewController()
    }

    func openLinkInSafariViewController() {
        if let url = URL(string: "https://wow.pubscale.com?app_id={app_id}&user_id={user_id}&idfa={idfa}") {
            let safariVC = SFSafariViewController(url: url)
            safariVC.modalPresentationStyle = .formSheet
            present(safariVC, animated: true, completion: nil)
        } else {
            print("Invalid URL")
        }
    }
}

```

#### Notes:

* This code should be placed in a `UIViewController` subclass.
* You can call `openLinkInSafariViewController()` when appropriate (e.g., on a button tap or in `viewDidLoad` as shown).
* Don't forget to import `SafariServices`.
* Don't forget to replace the {app\_id} ,{user\_id} and {idfa} with the actula value.
* If your  App is not approved from PubScale you might see an error page.\
  \
  ![](https://4253310960-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwtFu5cQcg9ZXDSngP2aN%2Fuploads%2FBWTxceAkaguCV1zQT6eh%2FScreenshot%202025-04-23%20at%205.19.10%E2%80%AFPM.png?alt=media\&token=81670fb8-3f35-4cf0-8e53-69d5c7a09049)\
  \
  If you see this error,&#x20;

  * Check your App ID and make sure it is correct.
  * If your App ID is correct then its possible your App ID is not approved yet, in that case please reach out to your Account Manager to get your App approved.<br>

  If your configuration is correct, you will see a page similar to the screenshot below.\
  \ <img src="https://4253310960-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwtFu5cQcg9ZXDSngP2aN%2Fuploads%2FtgqerDOl95wNtqKZd9FB%2FScreenshot%202025-04-23%20at%205.30.08%E2%80%AFPM.png?alt=media&#x26;token=0b19efdf-2b9a-4c24-b364-98a0f0f12d48" alt="" data-size="original">

## 2. Setup Server-to-Server(S2S) callbacks <a href="#id-3.-test-the-offerwall" id="id-3.-test-the-offerwall"></a>

Set up the Server-to-Server (S2S) callbacks to receive instant updates whenever a user completes an offer and earns a reward. When an offer is completed, our server will send a notification to the configured callback URL. This callback provides the necessary information to process and verify the reward for the user in your application. [Learn more.](https://pubscale.gitbook.io/offerwall-sdk/1.0.10/server-to-server-s2s-callback-configuration)

## 3. Test the OfferWall <a href="#id-3.-test-the-offerwall" id="id-3.-test-the-offerwall"></a>

{% hint style="info" %}
Please use the sandbox environment for testing purposes to get instant callbacks and rewards. To learn how to enable the Sandbox environment, [click here](https://pubscale.gitbook.io/offerwall-sdk/1.0.10/sandbox-environment/sandbox-environment).
{% endhint %}

To ensure your OfferWall integration is working perfectly, follow these steps during the testing phase.

* Open the offerwall and verify that all offers are displayed correctly.
* Complete an offer and confirm that a callback is received from PubScale server to your server. For the sandbox environment, ensure the callback URL is configured properly to receive sandbox callbacks.
* Ensure the hashing technique used matches the one specified in the documentation.
* Verify that the reward value received matches the value displayed for the offer.
* Confirm that the callback is received only from PubScale's [whitelisted server IPs](https://pubscale.gitbook.io/offerwall-sdk/1.0.10/s2s-callback-configuration/ip-whitelist).&#x20;
