Warning: is_writable(): open_basedir restriction in effect. File(/var/www/clients/client2/web93/web/wp-content/uploads/broken-link-checker/blc-log.txt) is not within the allowed path(s): (/var/www/clients/client1/web15/web:/var/www/clients/client1/web15/private:/var/www/clients/client1/web15/tmp:/var/www/supersonic-knowledge.rtl.co.il/web:/srv/www/supersonic-knowledge.rtl.co.il/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web15/web/wp-content/plugins/broken-link-checker/core/init.php on line 141
Offerwall Integration for iOS - Supersonic Knowledge Center

Offerwall Integration for iOS

Get up and running with the Offerwall Ad Unit in 4 easy steps:

  1. Implement the Delegate
  2. Initialize the Offerwall Unit
  3. Present the Offerwall
  4. Reward the User

 

Before You Start

Make sure that you have correctly integrated the Supersonic SDK into your application. Integration is outlined here.

Step 1. Implement the Delegate

The Supersonic SDK fires several events to inform you of ad availability and completions so you’ll know when to reward your users.
To receive these events, register to the delegate 
delegatesetOWDelegate:owDelegate:

OBJECTIVE-C
(void)setOWDelegate:(id<SupersonicOWDelegate>) owDelegate;

SWIFT

func setOWDelegate(owDelegate:SupersonicOWDelegate)

Note: Please do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from Supersonic callbacks need to be passed on to the main thread before execution.

The SDK will notify your delegate of all possible events listed below:

OBJECTIVE-C
@protocol SupersonicOWDelegate
@optional
/**
* Indicates that initiating the Offerwall was completed successfully
**/
- (void)supersonicOWInitSuccess;
/**
* Will be triggered in case Offerwall was not able to initiate, for example:
* when there is no internet connection, servers are unavailable etc.
* @param error - will contain the failure code and description
**/
- (void)supersonicOWInitFailedWithError:(NSError *)error;;
/**
* Called each time the Offerwall successfully loads for the user
**/
- (void)supersonicOWShowSuccess;
/**
* Called each time the Offerwall fails to show
* @param error - will contain the failure code and description
**/
- (void)supersonicOWShowFailedWithError:(NSError *)error;
/**
* Called each time the user completes an offer.
* @param creditInfo - A dictionary with the following key-value pairs:
* @"credits" - (integer) The number of credits the user has Earned since the
* last supersonicOWDidReceiveCredit event that returned 'YES'. Note that the
* credits may represent multiple completions (see return parameter).
* @"totalCredits" - (integer) The total number of credits ever earned by the
* user.
* @"totalCreditsFlag" - (boolean) In some cases, we won’t be able to provide
* the exact amount of credits since the last event(specifically if the user
* clears the app’s data). In this case the ‘credits’ will be equal to the
* @"totalCredits", and this flag will be @(YES).
* @return The publisher should return a boolean stating if he handled this
* call (notified the user for example). if the return value is 'NO' the
* 'credits' value will be added to the next call.
**/
- (BOOL)supersonicOWDidReceiveCredit: (NSDictionary *)creditInfo;
/**
* Called when the method
* ‘-getOWCredits’
* failed to retrieve the users credit balance info.
* @param error - the error object with the failure info
**/
- (void)supersonicOWDidFailGettingCreditWithError:(NSError *)error;
/**
* Called when the user closes the Offerwall
**/
- (void)supersonicOWAdClosed;
@end

SWIFT

@protocol SupersonicOWDelegate <NSObject>
@optional
/**
 * Indicates that initiating the Offerwall was completed successfully
**/
- (void)supersonicOWInitSuccess;
/**
 * Will be triggered in case Offerwall was not able to initiate, for example:
 * when there is no internet connection, servers are unavailable etc.
 * @param error - will contain the failure code and description
**/
- (void)supersonicOWInitFailedWithError:(NSError *)error;;
/**
 * Called each time the Offerwall successfully loads for the user
**/
- (void)supersonicOWShowSuccess;
/**
 * Called each time the Offerwall fails to show
 * @param error - will contain the failure code and description
**/
- (void)supersonicOWShowFailedWithError:(NSError *)error;
/** 
 * Called each time the user completes an offer.
 * @param creditInfo - A dictionary with the following key-value pairs:
 * @"credits" - (integer) The number of credits the user has Earned since the
 * last supersonicOWDidReceiveCredit event that returned 'YES'. Note that the
 * credits may represent multiple completions (see return parameter).
 * @"totalCredits" - (integer) The total number of credits ever earned by the
 * user.
 * @"totalCreditsFlag" - (boolean) In some cases, we won’t be able to provide
 * the exact amount of credits since the last event(specifically if the user
 * clears the app’s data). In this case the ‘credits’ will be equal to the
 * @"totalCredits", and this flag will be @(YES).
 * @return The publisher should return a boolean stating if he handled this
 * call (notified the user for example). if the return value is 'NO' the
 * 'credits' value will be added to the next call.
**/
- (BOOL)supersonicOWDidReceiveCredit: (NSDictionary *)creditInfo;
/** 
 * Called when the method  
 * ‘-getOWCredits’ 
 * failed to retrieve the users credit balance info.
 * @param error - the error object with the failure info
**/
- (void)supersonicOWDidFailGettingCreditWithError:(NSError *)error;
/**
 * Called when the user closes the Offerwall
**/
- (void)supersonicOWAdClosed;
@end

Step 2. Initialize the Offerwall Unit

Once the Offerwall Ad Unit is initialized, you will able to call functions on it. We recommend initializing the Offerwall on application launch.

OBJECTIVE-C
[[Supersonic sharedInstance] setOWDelegate:YOUR_OFFERWALL_DELEGATE];
[[Supersonic sharedInstance] initOWWithAppKey:APP_KEY withUserId:USER_ID];

SWIFT

Supersonic.sharedInstance().setOWDelegate(YOUR_OFFERWALL_DELEGATE)
Supersonic.sharedInstance().initOWWithAppKey(APP_KEY, withUserId: USER_ID)

Note:

  • APP_KEY is the unique ID of your Application in your Supersonic account.
    Supersonic Application Key
  • USER_ID is the unique ID of your end user. We support NSString from 1 to 64 characters. Common practice is to use the Apple Advertising ID (IDFA). More information on this User IDs can be found here.
  • Optional: The Offerwall supports additional parameters on the Init to customize your Offerwall request. See the Customized Parameters document for more information.
  • Step 3. Present the Offerwall

    Once you receive the supersonicOWInitSuccess delegate you are ready to present the Offerwall to your user.  When you want to serve the Offerwall (typically after a user clicks on some in-app button), call the showOW method on your Supersonic instance:

    OBJECTIVE-C
    [[Supersonic sharedInstance] showOW];

    SWIFT

    Supersonic.sharedInstance().showOW()

    Note: If you are using client-side calling, call this instance before you show the Offerwall to your users. []

    Step 4. Reward the User

    Supersonic supports two methods to reward your users. Select one of the following:

    1. Proactive Polling API
    2. Automatic Client-Side Events

    Method 1: Proactive Polling API

    You may call the function getOWCredits at any point during the user’s engagement with the app. You will then receive information on the user’s total credits and any new credits the user has earned.
    See Step 1 for instructions on how to implement the protocol and receive callbacks for the following method:

    OBJECTIVE-C
    [[Supersonic sharedInstance] getOWCredits];

    SWIFT

    Supersonic.sharedInstance().getOWCredits()

    Method 2: Automatic Client-Side Events

    You can receive client-side events automatically within your application by registering to the Offerwall delegate. To do so:

    Important! This code MUST be implemented before calling the initOWWithAppKey.

    1. Import the Supersonic Configuration and set the use of client-side completion callbacks as follows:
      OBJECTIVE-C
    #import <Supersonic/SUSupersonicAdsConfiguration.h>

    SWIFT
    No import required with Swift.

    OBJECTIVE-C

    [SUSupersonicAdsConfiguration getConfiguration].useClientSideCallbacks = [NSNumber numberWithInt:1];

    SWIFT

    SUSupersonicAdsConfiguration.getConfiguration().useClientSideCallbacks = NSNumber(int:1)

    • Once there is a completion event from the user the Supersonic SDK will fire: (BOOL)supersonicOWDidReceiveCredit:(NSDictionary *)creditInfo event informing you of the completion.
    • Optional: Server-to-Server Reward Callbacks
      To utilize server-to-server callbacks, see here.
      Note:

     

    1. The default setting in your Supersonic account notifies you of user’s completions or rewards via the supersonicDidReceiveCredit callback within the client of your app. Additionally, you can turn on server-to-server callbacks to receive additional notifications to your back-end server.
    2. If you turn on server-to-server callbacks in addition to the client-side callbacks, remember not to reward the user more than once for the same completion. Supersonic will fire both the client-side callback and the server-to-server callback. You will get two notifications for each completion.

     

    Done!
    You are now all set to deliver Offerwall Ad Units in your application.

    Tip: If this is a new integration, your application in your Supersonic account will by default be in ‘Test Mode‘. While in Test Mode, the Supersonic SDK will print more logs to the console in order to provide greater visibility into the SDK processes. In addition, the first ad you will see will be a Supersonic test campaign. Turn on Live Ad Inventory in the App Settings page of your Supersonic console.

    Supersonic Switch App to Live Mode Offerwall Ad Unit



    What’s Next?
    You are now all set to deliver the Offerwall Ad Unit in your application. Follow our integration guides to integrate additional Ad Units: