This page will show you how to integrate Leadbolt ads in your iOS native app. Download the SDK and sample app. Make sure you can compile the sample app and see test ads.

To get started sign up for a Leadbolt Publisher account here or login to the Publisher Portal here.

gstart


Add your apps

Login to the Publisher Portal and select the ‘Create New App’ button from the “Apps” page. Fill in your app’s details including name and platform. Once app is added, it is recommended that you also apply for our premium deals by clicking “Direct Deals” in the Publisher Portal. Once approved, a “Direct Deals” section should be visible under your app in the Publisher Portal. Use the “Add Section” button if not visible.

 


Copy Your Integration Details

Your integration details will be displayed on the last page of the Create App process. These integration details will be needed when you integrate the Leadbolt SDK into your app.

Create App Dialogue-3


Integrating Leadbolt SDK

Unzip the downloaded zip file and copy the libAppTracker.a  and AppTracker.h  files to your XCode project.

Add the required frameworks to your XCode project

  • AdSupport.framework
  • AVFoundation.framework
  • CoreMedia.framework
  • CoreTelephony.framework
  • StoreKit.framework
  • SystemConfiguration.framework
  • UIKit.framework

Add Bridging Header

To use Objective-c headers in your Swift coded App, you will need to create a Objective-C Bridging Header. Simply add a new Header File to your App and name it Objective-CBridgingHeader.h. In that file, add the following lines of code:

Now under your App’s Build Settings, find the Objective-C Bridging Header setting and add the full path of the Objective-CBridgingHeader.h file in there.

To ensure all available Leadbolt ads display correctly on apps running on iOS 9/10, please include these App Transport Security (ATS) settings by adding the following lines of code to your Apps Info.plist file:


Using Network Ads and Direct Deals

Add the following single section of code to your app’s View Controller class to integrate an ad into your App.

You will need to replace   "YOUR_APP_API_KEY" with the specific api key for your app (include the double quotes). This is available in the settings menu for your app, under the option “Get App API Key”. To get Direct Deal Ads in your App, click on “Direct Deals” link in the Publisher Portal and click on the Apply button. If your app includes audio or background audio, please ensure you pause audio during ad display.

Passing additional information

You can increase your App’s performance by optionally including the additional information below. This allows selected premium advertisers to display their Ads to your users. To pass this additional information, use the following methods BEFORE calling loadModuleToCache


Using  Rewarded Video

To run rewarded video in your App, you will need to apply and be approved. Click on “Rewarded Videos” link in the Publisher Portal to apply or contact your account manager.

When implementing “Rewarded Videos”, please make use of the following code in your App that displays a rewarded video and triggers a client side event listener when the user has watched the video. Check that a “Rewarded Video” section is visible under your app in the Publisher Portal. Use the “Add Section” button if not visible. Contact your account manager if you require a server side postback when the user has watched the video. If your app includes audio or background audio, please ensure you pause audio during ad display.

Please make use the following code in your App.

Once the ad serving code is included in your app, compile and test your app to confirm test ads are appearing correctly. Once confirmed, set your app to active in the Publisher Portal and follow the prompts to receive live ads.

Passing additional information

You can increase your App’s performance by optionally including the additional information below. This allows selected premium advertisers to display their Ads to your users. To pass this additional information, use the following methods BEFORE calling loadModuleToCache


Implementing event listeners in your app

With Event listeners, you can closely follow the ad states throughout your App. Leadbolt SDK will trigger events at all important stages of the Ad life-cycle. To implement event listeners in your App, you need to make use of the AppModuleDelegate class. First implement the AppModuleDelegate protocol your ViewController class as follows:

Now in your ViewController add the following delegate methods:

Now call the AppTracker.setAppModuleDelegate(self);  function before calling startSession() . Your code should look something like:

Troubleshooting

  • Ads may not be available at all times in all countries. It is always best to test with your App in Test Mode in the Publisher Portal as Test Ads are generally always available.
  • You should check the SDK logs located in Device Logs (under Xcode -> Devices) and look for “AppTracker”.
  • Always test the sample app provided to confirm any integration issues are SDK based.
  • The SDK has been tested to be compatible on Xcode Verion 8.2.1

gstart

 

← Return to Help Center