Difference between revisions of "In-App SDK 11.1 Documentation"

From docs.airnowmedia.com
Jump to: navigation, search
m (Admin moved page In-App SDK 11.0 Documentation to In-App SDK 11.1 Documentation without leaving a redirect)

Revision as of 03:34, 1 September 2021



iOS In-App SDK 11.1 Documentation


The Airnowmedia SDK is the most powerful app monetization solution in the industry, providing developers with stunning performance and weekly payouts. Airnowmedia developers consistently earn many times more revenue than with any other ad network because our advanced new ad units outperform everything else available in the industry. This document covers installation instructions, available ad units and their features, optimization, and best practices. It is written for developers with the assumption they are familiar with iOS development.

Ad Units

There are 4 types of ad units available in this SDK. To enable and optimize each of these ad units, select the corresponding check box next to each ad unit in 'Step 2' of adding your app.

In-App and Inline Banner Ads

In-App and Inline Banner Ads are a staple of the mobile advertising world. Combined with the rest of Airnowmedia’s industry leading ad types, In-App Banner Ads enable iOS developers to monetize their users at every point in their mobile experience and maximize their revenue.


Interstitial is a revolutionary new interstitial format that dramatically outperforms all other others on the market.


VAST is a Video Ad Serving Template for structuring ad tags that serve ads to videoplayers. Using an XML schema, VAST transfers important metadata about an ad from the adserver to a video player.

Rewarded VAST Ads

VAST is a Video Ad Serving Template for structuring ad tags that serve ads to videoplayers. Using an XML schema, VAST transfers important metadata about an ad from the adserver to a video player. Users can receive rewards for viewing this type of ads

Installation Instructions

The Airnowmedia InApp iOS SDK contains the code necessary to install Airnowmedia in-app ads in your application.

Airnowmedia InApp iOS SDK Requirements:
  1. iOS 11.1 or later
  2. XCode 11.1 or later
Step 1 – Adding the AirMonetizationSDK.xcframework
  1. Open your project folder.
  2. Page-2-Image-0.jpg

  3. Copy the AirMonetizationSDK.xcframework to your project folder.
  4. Page-2-Image-2.jpg

  5. Add the AirMonetizationSDK.xcframework to your project using "Add Files to YOUR_PROJECT"
  6. Page-2-Image-3.jpg Page-3-Image-4.jpg

  7. Go to “Frameworks, Libraries, and Embedded Content” tab of your project target and set "Embed & Sign" for the AirMonetizationSDK.xcframework.
  8. Page-4-Image-5.jpg

Step 2 – Configure your project to receive ads.
  1. Add the following permissions to your project's Info.plist file.
  1. App Transport Security Setting -> Allow Arbitrary Loads -> YES
  2. For iOS 14.0 or later: Privacy – Tracking Usage Description -> YOUR DESCRIPTION OF WHY A USER SHOULD GRANT THE APPLICATION ACCESS TO THE IDFA.
  3. Add ad network support to your project's Info.plist file. Our ad network id - v6d33e8t63.skadnetwork.

    You must lowercase the ad network identifier string, otherwise, the system won't recognize it as valid.

    Page-5-Image-6.jpg Page-5-Image-7.jpg

    More information is about Ad Network here - SKAdNetwork - Configuring a Source App
  4. Page-5-Image-8.jpg

NOTE: This may affect the number of clicks on advertising banners.

  1. Import our iOS SDK to the files where you want to use it.

    import AirMonetizationSDK
  2. Import AppTrackingTransparency framework for iOS 14.0 or later.

    import AppTrackingTransparency

    Finally, ask the user for permission to provide personalized ads. If you call “ATTrackingManager.requestTrackingAuthorization(completionHandler:)” method when you do not have permission on Info.plist file, you will get an app crash.

    ATTrackingManager.requestTrackingAuthorization { status in
                    switch status {
                    case ATTrackingManager.AuthorizationStatus.authorized:
                    case ATTrackingManager.AuthorizationStatus.denied:
                    case ATTrackingManager.AuthorizationStatus.restricted:
                    case ATTrackingManager.AuthorizationStatus.notDetermined:
                    @unknown default:

    NOTE: If you load some ads before you request user permissions, the user won’t receive personalized ads.

Step 3 – Code Integration.

AirMonetization SDK currently supports 4 types of advertising: Inline and In-App banners, Interstitial Ads, VAST Video Ads, Rewarded VAST Video Ads.

  1. Import **“AirMonetizationSDK”** in `AppDelegate.swift` file. Also add the following code in `didFinishLaunchingWithOptions` method. Also set the test mode for the SDK if necessary. In test mode, ads work as usual, but they are not tracked or monetized.
  2. AirMonetization.shared.setAPIKey(key: "YOUR_API_KEY", appID: "YOUR_APP_ID")
    AirMonetization.shared.setTestMode(testMode: true)


  3. Set the `APP ID` and `API KEY` in your project, which was given to you when registering your iOS application on Airnowmedia. It's a numeric code that can be found by locating your app in the apps dashboard.
  4. Page-2-Image-1.jpg

  5. Perform the following steps in the ViewController in which you wish to display Ads.
  1. Add an instance of “AirMonetizationAd” class to ViewController. For example:

    var adView: AirMotetizationAd? = nil
  2. Initialize adView instance with type of ad you want to use in your ViewController and implement its delegate methods. We recommend using the “viewWillAppear” method for this. You can initiate one of the following types of ads: Inline banner, in-app banner, interstitial ads, vast video ads. For example:

  3. In-App Banner
    adView = AirMonetizationInappBanner.inappBanner(withBannerSize: CGSize(width: 50, height: 300))
    adView?.setPlacementID(placementID: "0")
    adView?.delegate = self

    AirMonetizationInappBanner.inappBanner(withBannerSize:) – Returns instantiated AirMonetizationInappBanner object ready to load.

    setPlacementID(placementID:) - Set placement ID for in-app banners. For placement ID see your Dashboard.

    bannerSize - The specific size of the banner. If you don't set your value, the device screen size will be used.

    delegate - Delegate that implements AirMonetizationAdDelegate protocol.

    Inline banner
    adView = AirMonetizationInlileBanner.inlineBanner(bannerView: inAppBannerView, parentController: self, withBannerSize: CGSize(width: 50, height: 300))
    adView?.delegate = self

    AirMonetizationInlileBanner.inlineBanner(bannerView:, parentController:, withBannerSize:) - instantiated AirMonetizationInlileBanner object ready to load.

    bannerView - view you want to put the banner in.

    parentController - ViewController where you put inline banner.

    bannerSize - The specific size of the banner. If you don't set your value, the device screen size will be used.

    delegate - Delegate that implements AirMonetizationAdDelegate protocol.

    Interstitial Ads
    adView = AirMonetizationInterstitial.interstitial()
    adView?.delegate = self

    AirMonetizationInterstitial.interstitial() - instantiated AirMonetizationInterstitial object ready to load.

    delegate - Delegate that implements AirMonetizationAdDelegate protocol.

    VAST video Ads
    adView = AirMonetizationVAST.vastVideo()
    adView?.delegate = self

    AirMonetizationVAST.vastVideo() - instantiated AirMonetizationVAST object ready to load.

    delegate - Delegate that implements AirMonetizationAdDelegate protocol.

    Rewarded VAST video Ads
    adView = AirMonetizationRewarded.rewarded()
    adView?.rewardDelegate = self

    AirMonetizationRewarded.rewarded() - instantiated AirMonetizationRewarded object ready to load.

    rewardDelegate - Delegate that implements AirMonetizationRewardedAdDelegate protocol.

  1. To Receive delegate call back from AirMonetizationSDK, perform the following steps in ViewController

    • Confirm the AirMonetizationAdDelegate protocol.

    • Implement delegate methods in your ViewController.

    extension YourViewController: AirMonetizationAdDelegate {
        func adDidStartLoad(ad: AirMotetizationAd) {
            print("AirMotetizationAdDelegate: \(#function)")
    func adDidFinishLoad(ad: AirMotetizationAd) {
        print("AirMotetizationAdDelegate: \(#function)")
    func adDidShow(ad: AirMotetizationAd) {
        print("AirMotetizationAdDelegate: \(#function)")
    func adDidClick(ad: AirMotetizationAd) {
        print("AirMotetizationAdDelegate: \(#function)")
    func adDidClose(ad: AirMotetizationAd) {
        print("AirMotetizationAdDelegate: \(#function)")
    func adDidComplete(ad: AirMotetizationAd) {
        print("AirMotetizationAdDelegate: \(#function)")
    func adDidDismiss(ad: AirMotetizationAd) {
        print("AirMotetizationAdDelegate: \(#function)")
    func adDidFailWithError(ad: AirMotetizationAd, error: String) {
        print("AirMotetizationAdDelegate: \(#function)")
  2. To start loading ads, call the “load” method of your AirMonetizationAd instance. This method must be called each time when you want to load Interstitial ad and vast/rewarded vast video ad. This method must be called only once to load inline banner and in-app banner. The banners will be updated automatically.

  3. To show ad after ad is loaded, call the “show” method of your AirMonetizationAd instance in “adDidFinishLoad(ad:)” delegate method.

  4. To deinitialize AirMonetizationAd instance, call the following methods. We recommend calling these methods in viewWillDisappear method.

    if adView != nil {
        adView = nil

    Description of AirMonetizationAd methods

    “load” method

    func load()

    Description: Starts loading an Ad. If ad is already loaded calling this method dismiss it a new ad will start load.

    “show” method

    func show()

    Description: Shows the loaded ad on screen. If called before ad is loaded it will return an error on its delegate. You have to call this method by yourself in adDidFinishLoad (AirMonetizationAdDelegate) method.

    “dismiss” method

    func dismiss()

    Description: Hides, dismisses the ad, deallocates resources. If ad is currently loading - it will be stopped dismissed.

    “stop” method

    func stop()

    Description: Stops the ad's loading. For In-App and Inline Banner also stops the refreshing.

    “removeFromViewController” method

    func removeFromViewController()

    Description: Removes the ad from parent view controller. Required to remove Inline banner from the parent view controller.

    Description of AirMonetizationAdDelegate methods

    “adDIdStartLoad(ad:)” method

    func adDidStartLoad(ad: AirMotetizationAd) {

    Description: Invoked just after starting ad loading request to server. param ad – Corresponding AirMotetizationAd object.

    “adDidFinishLoad(ad:)” method

    func adDidFinishLoad(ad: AirMotetizationAd) {

    Description: Invoked once ad is loaded and ready to show. You have to call show method on AirMotetizationAd by yourself. Otherwise, it won't be displayed. Use this method to pause any activity like game/video/music etc. and then show the ad. param ad – Corresponding AirMotetizationAd object.

    “adDidShow(ad:)” method

    func adDidShow(ad: AirMotetizationAd) {

    Description: Invoked after ad is displayed on screen. param ad – Corresponding AirMotetizationAd object.

    “adDidClick(ad:)” method

    func adDidClick(ad: AirMotetizationAd) {

    Description: Invoked just after user's click on ad but before its processing. param ad – Corresponding AirMotetizationAd object.

    “adDidClose(ad:)” method

    func adDidClose(ad: AirMotetizationAd) {

    Description: Invoked after user closed an ad with a close button. param ad – Corresponding AirMotetizationAd object.

    “adDidComplete(ad:)” method

    func adDidComplete(ad: AirMotetizationAd) {

    Description: Invoked after a user's click on ad is processed and user is redirected to advertiser's URL. Also invoked after user finishes ad action. Getting this delegate's event while redirection usually means that application is left and likely is going to background. Process it appropriately. param ad – Corresponding AirMotetizationAd object.

    “adDidDismiss(ad:)” method

    func adDidDismiss(ad: AirMotetizationAd) {

    Description: Invoked when all ad actions are finished and ad deallocated its resources. After this method you can deallocate AirMotetizationAd object itself. Use this method to continue playing of your game/video/audio. param ad – Corresponding AirMotetizationAd object.

    “adDidFailWithError(ad:, error:)” method

    func adDidFailWithError(ad: AirMotetizationAd, error: AirMonetizationError) {

    Description: Invoked in case of any error occurred on ad loading, displaying etc. param ad – Corresponding AirMotetizationAd object. param error – AirMonetizationError with error description (contained “moreInformation” property).

    AirMonetization SDK Test Mode

    You can set Test Mode to configure ads in your app. In test mode Ads are working as usual but aren't tracked and monetised.

    “setTestMode(testMode:)” method

    AirMonetization.shared.setTestMode(testMode: true)

    Description: Sets test mode for the SDK. In test mode Ads are working as usual but aren't tracked and monetised. param testMode - Boolean value that must be set to enable or disable Test Mode.

    “isTestMode” value

    let isTestMode: Bool = AirMonetization.shared.isTestMode

    Description: Returns current test mode state return BOOL true if test mode is enabled. return BOOL false if test mode is disabled.

Advertising Identifier Usage

AirmonetizationSDK uses Advertising Identifier to server advertisements with in app, kindly select it accordingly while publishing your app to App Store.


Important Instructions

• For the best experience, please use the latest iOS SDK.

• If you are upgrading/updating the SDK, please don't forget to clean & build the project after completing all steps successfully.

Sample Application Code and Support

You can download the demo project "iOS SDK Integration DemoApp" using the following link NEED TO ADD A LINK. This is code demonstration on 'How to integrate AirMonetization iOS SDK' in your app. Demo app will work without any modifications on simulator. If you need to run it on your device, attach your provisioning profile in the app and run it. > Note: For the privacy of your users, Airnowmedia never stores personally identifiable information.

Personal tools