ayeT-Studios Publisher iOS (Swift) SDK Integration Guide (v1.4.2)


2018-09-29: v1.4.2 - Updated iOS SDK to Xcode 10 and Swift 4.2, stripped debug symbols
2018-07-09: v1.4.1 - Removed Simulator Code from iOS SDK, fixed iTunes validation issues with Xcode 9+
2018-05-07: v1.4 - Framework recompiled with Swift 4.1
2018-03-08: v1.3 - You are able to use logs now in order to locate implementation problems
2018-01-20: v1.2 - Added functions that provide current user balances
2017-12-06: v1.0 - Initial Release of our Publisher SDK (iOS)


The ayeT-Studios Publisher SDK allows you to easily monetize your app and reward your users with in-app currency. Your users get access to our offerwalls, allowing them to earn currency for completing tasks such as trying new apps, answering surveys, signing up for free trials or watching video ads. The integration is simple, allows both managed (our servers store user information and balances) and unmanaged (you receive callbacks and handle user wallets yourself) currencies and also works well alongside traditional in-app purchases.


  1. Prerequisites
  2. Download the library
  3. Add the library to your Xcode project
  4. Initialize the SDK & Receive Managed Balances
  5. Check User Balances (Managed Currency Handling)
  6. Show the Offerwall
  7. Logs
  8. Appendix I: Unmanaged Currency Handling / Conversion Callbacks

1. Prerequisites

Before integrating the SDK in your app, you should sign up for a publisher account. Afterwards login as publisher and create a new iOS App Placement using the correct (Xcode) bundleId you intend to use for your final app.
This is important since we'll generate an APP_KEY / Identifier for you which has to be added to SDK init call.

2. Download the library

You can download the lastest version of our publisher library here:

3. Add the library to your Xcode project

Unzip the downloaded archive file, preferably inside your project directory and add the framework to your project:

Click on your project icon in the Project Navigator, select General tab and then expand Embedded Binaries.
Be sure the framework you extract in your project directory is already there. If not, click the "+" symbol in the lower left of the section and add it.
Repeat the same procedure for Linked Frameworks and Libraries, the final configuration should look like this:

Please add the following to your Info.plist file:

4. Initialize the SDK & Managed User Balances

You'll need to initialize Ayet SDK before being able to use it.
A good place to do this is the application:didFinishLaunchingWithOptions: method in your application delegate:
import AyetStudiosSDK
AyetSdk.sdkInit(appKey: "<your placement identifier from our dashboard>" , userIdentifier: "<optional, unique user identifier>" , callback: { available_currency , pending_currency , spent_currency in
    print("Available currency:  \(available_currency)")
    print("Pending currency:    \(pending_currency)")
    print("Spent currency:      \(spent_currency)")

If you want to spend user currency, for example if the user clicks a button assigned to a purchaseInAppItem function, you can utilize the deductBalance function:
@IBAction func purchaseInAppItem(_ sender: Any) {

    let deductAmount = 5

    AyetSdk.deductBalance(amount: deductAmount , deductCallback: {callback in

        if (callback.caseInsensitiveCompare("success") == .orderedSame) {
            print("Deduct response is successful");
            // TODO: activate the purchased content
        else {
            print("Deduct response is unsuccessful");
            // this usually means that the user does not have sufficient balance in his account

The status string will be "success" if the balance deduction was successful or "failed" if something went wrong (e.g. insufficient user balance).

Hint: If you do not supply a user identifier, we track account balances by device. Otherwise balances will be credited and stored for the identifier (e.g. username, hashed email address, etc.).

5. Check User Balances (Managed Currency Handling)

After initializing the SDK, you can check the current user balances anywhere in your code:




6. Show the Offerwall

Showing the offerwall is straight-forward, you can simply call showOfferwall from your UIViewController:

AyetSdk.showOfferwall(currentController: self);	                
showOfferwall starts our offerwall activity and displays available tasks for the user to complete.

7. Logs

If you want to see logs in xcode debug area, simply call sdkLogEnable before initializing sdk.


8. Appendix I: Unmanaged Currency Handling / Conversion Callbacks

If you want to manually manage your users currencies on your own servers, you can configure a conversion callback url in our publisher dashboard.
To do so, navigate to Placements / Apps, edit your app placement and set the Callback Url to your server's postback url:

If this is the callback url your set for your app placement:

A typical conversion callback sent by our server will look like this:
* Note: This assumes you set the user identifier to username in your AyetSdk.init(..) call, the currency conversion rate in your placement was 1000 per $1 and the user completed an offer with a $0.36 payout.

Important: Your server must always reply with an HTTP 200 status code to our postbacks. Otherwise we will resend the postback 12 times over a span of one hour before giving up.

Available Macros for Postback URLs:
{transaction_id}stringUnique transaction id - use for duplicate checks
{payout_usd}floatThe actual conversion payout in USD
{currency_amount}intThe amount of currency the user earned (taken from your offerwall currency configuration)
{uid}stringThe user identifier set in your app for this user when initializing the sdk
{user_id}integerOur internal id for this offerwall user
{placement_identifier}stringThe placement_identifier for which the conversion occured
{ip}stringConverting device's IP address if known, otherwise
{offer_id}intOffer ID of the converting offer
{offer_name}stringName / title of the converting offer
{device_uuid}stringayeT-Studios internal device identificator
{device_make}stringDevice manufacturer
{device_model}stringDevice model
{advertising_id}stringDevice advertising id (GAID/IDFA) if known, otherwise empty
{sha1_android_id}stringDevice sha1 hashed android id if known, otherwise empty
{sha1_imei}stringDevice sha1 hashed imei if known, otherwise empty

If your want to restrict postbacks to our callback server IPs, please whitelist the following IPs and check back regularly for possible changes:	    
Last IP List Update: 2017-04-07