- What’s new in 5.0
- Download the MoPub iOS SDK
- Incorporate the MoPub iOS SDK
- Using Git
- Using CocoaPods
- Adding Third Party ad Networks
What’s new in 5.0
This document details the process of integrating the MoPub SDK with your mobile application. If you have any questions, don’t hesitate to email us at firstname.lastname@example.org.
Here are the basic integration steps:
- Download the MoPub SDK
- Add the SDK to your Xcode project.
- Verify the viewability integration through your device logs
- Create and use a Banner or Interstitial ad.
MoPub SDK v4.16 and above integrates technology from our partners Integral Ad Science, Inc. (“IAS”) and Moat, Inc. (“Moat”) in order to support viewability measurement and other proprietary reporting that IAS and Moat provide to their advertiser and publisher clients. You have the option to remove or disable this technology by following the opt-out instructions.
Download the MoPub iOS SDK
The MoPub SDK is distributed as source code that you must include in your application. MoPub provides two prepackaged archives of source code:
Includes everything you need to serve HTML, MRAID, and Native MoPub advertisements. Third party ad networks are not included.
Includes everything you need to serve HTML and MRAID advertisements. Third party ad networks and Native MoPub advertisements are not included.
Incorporate the MoPub iOS SDK
These instructions assume that you have downloaded one of the MoPub SDK zip archives.
Download and unzip the MoPub iOS SDK.
Drag the MoPubSDK folder into your Xcode application group (be sure to check the “Copy items into destination group’s folder” option).
Add the following frameworks to your project. To do this, click on your application’s target, then click on Build Phases and expand the Link Binary With Libraries group. The MoPub Base SDK requires the following frameworks:
App Transport Security Settings
App Transport Security (ATS), introduced in iOS 9, is a default setting which requires apps to make network requests only via HTTPS.
UPDATED: Apple has extended the ATS deadline indefinitely. We recommend publishers disable ATS to ensure ads are served correctly.
Use the following ATS key/value in your app’s Info.plist file
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
The Info.plist can also be edited directly in Xcode. Set the key’s boolean flag to
The above settings will disable ATS on iOS 9 and iOS 10 for the app.
ATS Setting Justification
Publishers will have to provide justification during the App Store review process for setting any of these ATS keys to YES in any MoPub SDK version. Per Apple’s App Store Review for ATS documentation, loading web content from a variety of sources (for ads) is an acceptable justification.
For more information about ATS and these settings, see our ATS help article.
For Applications that use MRC
If your application uses Manual Reference Counting (MRC) you must tell the compiler to build the MoPub iOS SDK source files with ARC. This has no impact on your application and can be done relatively easily:
First, click on your application’s target, then click on Build Settings. Set the Weak References in Manual Retain Release setting to
YES. Next, click on Build Phases and expand the Compile Sources group. Now select all the MoPubSDK source files. These will be grouped together near the end if you have recently dragged the SDK in.
Once the files are selected scroll down and double click on the last file. You should see a blank popup appear. Enter
-fobjc-arc and hit return. This should add the
-fobjc-arc flag to all the selected files.
While the bundled zips are the preferred method to install the MoPub SDK you can, instead, clone the git repository:
git clone git://github.com/mopub/mopub-ios-sdk.git
The installation instructions are similar to the ones outlined above for the zip archives. To install the base SDK you must drag in the contents of the
The MoPub SDK is available through Cocoapods, a popular dependency management system for Objective-C projects.
To download and incorporate the MoPub SDK into your project using Cocoapods, add the following line to your project’s podfile:
pod install (if you’re setting up Cocoapods for the first time) or
pod update (if you’re adding MoPub to an existing Cocoapods project), your project will be ready to use the base MoPub SDK.
Adding Third Party ad Networks
Please refer to the following tutorial for the integration details.
To use the MoPub SDK in your Swift project, simply import
MoPubSDK/MoPub-Bridging-Header.h to your project and ensure the Objective-C Bridging Header build setting under Swift Compiler - Code Generation has a path to the header
Last updated May 31, 2018
TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.
© 2018 MoPub Inc.