MoPub Integration - iOS

Step 1: Configuring Fyber Marketplace

Follow the steps below to configure Fyber Marketplace in the Mopub dashboard:

  1. Login to your [MoPub account](
  2. Click the **Networks** tab.
  3. Click **Add Network** on the top right corner of the screen.
  4. In the Add network window, scroll down and select **Custom SDK Network**
  5. In the **Add custom SDK network** window, enter "Fyber Marketplace" as the network name field within the "Networks Settings" tab.

Step 2: Configuring your Ad Units

Follow these steps to configure your ad units for the Fyber Marketplace Custom Adapters:

1.  Defining the way your custom adapters work with each ad unit, can be defined either:

  • During the initial custom network definition, or
  • Later by clicking the network name, within the **Networks** tab.

2. Scroll down to the unit you want to configure to work with Fyber Marketplace, and populate the **Custom event class** and **Custom event class data**, according to the required unit type.

Unit Type Custom Adapter Class
Banner InneractiveBannerCustomEvent
Rectangle/Medium (MRECT) InneractiveBannerCustomEvent
Interstitial InneractiveInterstitialCustomEvent
Rewarded InneractiveRewardedVideoCustomEvent

3. In the Custom event class data section add the relevant Spot ID you defined for the required unit, in Fyber's revenue desk, using the following JSON syntax (case sensitive):

{ "spotID" : "Your_Fyber_Spot_Id" }

4. Connecting your ad unit with a custom adapter class, adds it to all the segments containing the ad unit.

The network is then disabled and paused, by default.

To complete the integration, enable the required network within the segment definition.

Step 3: Initializing the Fyber Marketplace

There are two options available to you to initialize Fyber Marketplace.

Follow these steps to initialize the Fyber Marketplace:

Option 1

1. Add Fyber SDK to your project and copy adapter code from **Mopub 5.4.1** or **Mopub 5.5-5.8** depending on used Mopub SDK.

Option 2

Integrate via the Fyber Marketplace MoPub Adapter pod.
The pod can be found here:
This plugin is plug-and-play, it will install the Fyber Marketplace SDK and the Mopub SDK (5.6.0).

The minimum requirements are:

  • Fyber Marketplace SDK 7.3.1 (will be installed automatically)
  • Mopub SDK 5.5.0 / 5.6.0 (will be installed automatically)
  • iOS 8.0 for Fyber SDK+adapter (Mopub requires iOS 9.0 for part of their classes)
  • The adapter was tested and approved, using the Xcode 10.3 and the Cocoapods 1.6.2 (xcodeproj 1.9.0, ruby 2.5.1p57, rbenv 1.1.2)


1. Define the `Fyber_Marketplace_MoPubAdapter` pod inside the `Podfile` (remove the mopub pod, since it is part of the dependency anyway). E.g:

target 'test_spec_mopub_clean' do
  pod 'Fyber_Marketplace_MoPubAdapter'

2. Run `pod install` or the `pod update` in case it can't find the pod.

3. `App Delegate` - the Mopub SDK, starting from the 5.5.0, requires to be configured with all the custom adapters appropriately. The custom adapter class configuration needs to be passed. However, the Fyber's app ID and the spot ID are not needed to be passed in a "hardcoded" way. So just an empty "extra" may be passed, in case the Mopub's console is configured with the appropriate `appID` and `spotID` of Fyber. You can just add this code snippet and it will work:

#import "MPLogging.h"
#import "MoPub.h"
#import "IASDKMopubAdapterConfiguration.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {


  MPMoPubConfiguration *mopubConfig = [[MPMoPubConfiguration alloc] initWithAdUnitIdForAppInitialization:@""];

  mopubConfig.loggingLevel = MPBLogLevelDebug;
  [mopubConfig setNetworkConfiguration:@{} forMediationAdapter:NSStringFromClass(IASDKMopubAdapterConfiguration.class)];
  mopubConfig.additionalNetworks = @[IASDKMopubAdapterConfiguration.class];

  [MoPub.sharedInstance initializeSdkWithConfiguration:mopubConfig completion:nil];


  return YES;


For the 5.5.0 the `MPBLogLevelDebug ` needs to be changed to the `MPLogLevelDebug `. This is undocumented in the changelog of Mopub, but definitely happens.

4. The Mopub console's `JSON` needs to be defined in the following way:


In case it is defined differently - the source code of the adapter needs to be changed appropriately, but this is not a problem since the code is open source and it is demarked with the warnings.

5. The network name (in the Mopub's console) needs to be defined with the name of `inneractive` or the `IASDKMopubAdapterConfiguration`'s method `moPubNetworkName` needs to be updated appropriately.

6. ATS. The `NSAllowsArbitraryLoads` needs to be defined with `true`. However, if it's not, then the `useSecureConnections` should be set to `YES` in the ad request of Fyber.

7. That's it. The Mopub units needs to be configured, allocated and request for ads:

//  ViewController.m
//  test_spec_mopub_clean
//  Copyright © 2019 com.fyber.test. All rights reserved.

#import "ViewController.h"

#import "MPAdView.h"

@interface ViewController () 

@property (nonatomic, strong) MPAdView *mopubAdView;


@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    CGSize adSize = MOPUB_BANNER_SIZE;
    NSString *adUnitID = @"1234567890abcdefghigklmnopqrstuvwxyz";
    _mopubAdView = [[MPAdView alloc] initWithAdUnitId:adUnitID size:adSize];
    self.mopubAdView.delegate = self; =;
    [self.view addSubview:self.mopubAdView];
    [self.mopubAdView loadAd];

#pragma mark - MPAdViewDelegate

- (UIViewController *)viewControllerForPresentingModalView {
    return self;


Warnings can be Ignored

In case of passing the credentials via remote JSON and using the same network name as defined in this tutorial.

A "hardcoded" init can be Used

Then all the Fyber's warnings must be treated and the credentials are needed to be passed.

Passing the Cedentials using the Remote JSON

Can cause the first ad request to fail, this is because of the asynchronous init of the SDK, it will initialised during the response to the first ad request, since only there it gets the required credentials.

These folders reside in Inneractive Mediation Adapters folder inside of the SDK

If you are working with a Mopub version lower than 5.5.x you must initialize the Fyber Marketplace with your Fyber Application ID manually, by calling the following, before making any ad request:

[IASDKCore.sharedInstance initWithAppID:]; // init is mandatory;

If you are working with Mopub 5.5 and above:

  • Create a Mopub Configuration object
  • Add **IASDKMopubAdapterConfiguration** as an additional network
  • Pass it along with the Fyber Application ID using the setNetworkConfiguration method
  • Pass it on to Mopub by calling **initializeSdkWithConfiguration**
MPMoPubConfiguration *sdkConfig = [[MPMoPubConfiguration alloc] initWithAdUnitIdForAppInitialization:@"AD_UNIT_ID"];
    [sdkConfig setNetworkConfiguration:@{} forMediationAdapter:@"IASDKMopubAdapterConfiguration"];
sdkConfig.additionalNetworks = @[IASDKMopubAdapterConfiguration.class]; 
    [[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig completion:^{
        NSLog(@"SDK initialization complete");

Once everything is configured properly, Mopub recognizes the Fyber custom adapter classes, when requests are issued for the related units.

You can filter your logs with the Fyber keyword, to understand Fyber's internal request flow.