iOS Mopub Adapter Installation

iOS Mopub Adapter Installation

Requirements

  • The Appnext MoPub Adapter supports IOS 6+ devices only
  • The Appnext MoPub Adapter must be implemented with the relevant SDK - both can be downloaded at the top right of the page
  • The Appnext MoPub Adapter requires internet access to pull ads information for your app

📘

Choose the relevant adapter file!

The Mopub adapter has separate ZIP files, one for Ads (Interstitial and Rewarded/Fullscreen) and one for Native Ads. Make sure to download the adapter file according to your ad unit integration

Interstitial, Rewarded/Fullscreen and Banners Adapter Installation

Before starting the integration process, please download the following files:
Mopub SDK 4.19 and above: (Appnext version 1.9.4)

  • Appnext SDK from here
  • Appnext Mopub adapter (Interstitial, Fullscreen/Rewarded Video and Banners), from here

🚧

Please note!

The banners adapter is available for Mopub SDK 4.19 and above only

Mopub SDK 4.18 and below: (Appnext version 1.8.3.1)

  • Appnext SDK from here
  • Appnext Mopub adapter (Interstitial and Fullscreen/Rewarded Video), from here

Unzip the adapter zip and Appnext SDK files in a folder of your choice.
The MoPub adapter zip file includes the following components:

  • ‘AppnextMoPubAdapter/libAppnextMoPubAdapter.a’ the adapter library file.
  • ‘AppnextMoPubAdapter/include/AppnextMoPubAdapter’ folders containing the .h files for the SDK and MoPub adapter.
  • ‘AppnextMoPubAdapterTest’ folder containing an Objective-C application example project using the adapter.
  • ‘AppnextMoPubAdapterSwiftTest’ folder containing a Swift application example project using the adapter.
  • ‘CHANGELOG.md’ the adapter change log file.
  • ‘MoPubSDK’ folder containing the MoPub SDK sources used by the example projects.

The Appnext SDK zip file includes the following components:

  • ‘AppnextIOSSDK/libAppnextLib.a’ library file
  • ‘AppnextIOSSDK/libAppnextSDKCore.a’ library file
  • ‘AppnextIOSSDK/include/AppnextLib’ folder which include the .h interface files
  • ‘AppnextIOSSDK/include/AppnextSDKCore’ folder which include the .h interface files
  • ‘AppnextNewNativeLibSDKSwiftTest’ folder which include a swift example project
  • ‘AppnextNewNativeLibSDKTest’ folder which include an Objective-C example project
  • ‘CHANGELOG.md’ the SDK change log file.

Add the Appnext MoPub adapter and Appnext SDK to your project.

Link ‘libAppnextMoPubAdapter.a’, ‘libAppnextLib.a’ and ‘libAppnextSDKCore.a’ to your project.

  1. Click on your project in the ‘Project navigator’->’Build Phases’->’Link Binary With Libraries’ -> ’+’ -> ’Add Other…’ and go to the folder where you unzipped the adapter package. Choose ‘libAppnextMoPubAdapter.a’, ‘libAppnextLib.a’ and ‘libAppnextSDKCore.a’.
  2. Make sure to add the relative paths from your project’s directory to the libraries in the ‘Build Settings’->‘Library Search Paths’ (It should look something like – ‘$(PROJECT_DIR)/AppnextMoPubAdapter’ and also ‘$(PROJECT_DIR)/AppnextiOSSDK’).

Add the Appnext MoPub adapter and SDK .h files to your project

  1. Go to the ‘include/AppnextMoPubAdapter’ and ‘include/AppnextLib’ and ‘include/AppnextSDKCore’ folders and add all the .h files there to your project (grab all the .h files into the ‘Project Navigator’ area or grab the entire folders just the same).
  2. Make sure to add the relative path from your project’s directory to the ‘include’ folder in the ‘Build Settings’->‘Header Search Paths’. (It should look something like – ‘$(PROJECT_DIR)/AppnextMoPubAdapter/include’ and ‘$(PROJECT_DIR)/AppnextiOSSDK /include’).

Native Ads Integration Adapter Installation

Before starting the integration process, please download the following files:
Mopub SDK 4.19 and above: (Appnext version 1.9.4)

  • Appnext Native Ads SDK from here
  • Appnext Native Ads Mopub Adapter, from here

Mopub SDK 4.18 and below: (Appnext version 1.8.3.1)

  • Appnext Native Ads SDK from here
  • Appnext Native Ads Mopub Adapter, from here

Unzip the Adapter file and the SDK file to a folder of your choice. The adapter file includes the following components:

  • ‘AppnextNativeAdsMoPubAdapter/libAppnextNativeAdsMoPubAdapter.a’ the adapter library file.
  • ‘AppnextNativeAdsMoPubAdapter/include/AppnextNativeAdsMoPubAdapter’ folders containing the .h files for the Native Ads MoPub adapter.
  • ‘CHANGELOG.md’ the adapter change log file.

The SDK zip file includes the following components:

  • ‘AppnextNativeAdsSDK/libAppnextNativeAdsSDK.a’ library file
  • ‘AppnextNativeAdsSDK/libAppnextSDKCore.a’ library file
  • ‘AppnextNativeAdsSDK/include/AppnextNativeAdsSDK’ folder which include the .h interface files
  • ‘AppnextNativeAdsSDK/include/AppnextSDKCore’ folder which include the .h interface files
  • ‘AppnextNativeAdsSDKSwiftTest’ folder which include a swift example project
  • ‘AppnextNativeAdsSDKTest’ folder which include an Objective-C example project
  • CHANGELOG.md the SDK change log file

Add the Adapter and the SDK to your project

Link ‘libAppnextNativeAdsMoPubAdapter.a’, ‘libAppnextNativeAdsSDK.a’ and ‘libAppnextSDKCore.a’ to your project.

  • Click on your project in the ‘Project navigator’ → ’Build Phases’→’Link Binary With Libraries’ → ’+’ → ’Add Other…’ navigate to the unzipped adapter folder where you unzipped the adapter package. Choose ‘libAppnextNativeAdsMoPubAdapter.a’, ‘libAppnextNativeAdsSDK.a’ and ‘libAppnextSDKCore.a’.
  • Make sure to add the relative paths from your project’s directory to the libraries in the ‘Build Settings’->‘Library Search Paths’ (It should look something like – ‘$(PROJECT_DIR)/AppnextNativeAdsMoPubAdapter’ and also ‘$(PROJECT_DIR)/AppnextNativeAdsSDK’).

Add the Adapter and the SDK .h files to your project

  • Go to the ‘include/AppnextNativeAdsMoPubAdapter’ and ‘include/AppnextNativeAdsSDK’ and ‘include/AppnextSDKCore’ folders and add all the .h files there to your project (grab all the .h files into the ‘Project Navigator’ area or grab the entire folders just the same).
  • Make sure to add the relative path from your project’s directory to the ‘include’ folder in the ‘Build Settings’->‘Header Search Paths’. (It should look something like – ‘$(PROJECT_DIR)/AppnextNativeAdsMoPubAdapter/include’ and ‘$(PROJECT_DIR)/AppnextNativeAdsSDK/include’).

Adapter Installation

The following steps are relevant for both Ads (Interstitial and Rewarded/Fullscreen) and Native Ads

After completing the above steps (based on the adapter type), please perform the following steps:

Step 1: Add additional system frameworks to your project

These frameworks are required for the work of the SDK. Click on your project in the ‘Project navigator’->’Build Phases’->’Link Binary With Libraries’->’+’ and add the following frameworks:

  • ‘QuartzCore.framework’
  • ‘Security.framework’
  • ‘CFNetwork.framework’
  • ‘AVFoundation.framework’
  • ‘SystemConfiguration.framework’
  • ‘MobileCoreServices.framework’
  • ‘CoreGraphics.framework’
  • ‘CoreMedia.framework’
  • ‘AdSupport.framework’
  • ‘UIKit.framework’
  • ‘Foundation.framework’
  • ‘CoreTelephony.framework’

Step 2: Add additional Linker flags

Add ‘-ObjC’ linker flag.
Go to ‘Build Settings’->‘Other Linker Flags’ and add ‘-ObjC’ flag

696

Step 3: App Transport Security configuration

iOS 9 introduces a new feature called App Transport Security (ATS), which prevents an app from making non-secure connections.
Some of the install redirects from the SDK go through ‘http’ links. If ATS is not disabled, these redirects will be blocked and publisher revenue will drop.

To prevent this, add a new Dictionary entry to your app’s Info.plist file called AppTransportSecurity, then add an entry to that dictionary with a key of AllowsArbitraryLoads with YES as value.

After adding the entry your plist file will have the entry as marked:

578

What’s Next

Integrate one of the adapter's ad units