MoPub SDK Initialization

The MoPub 5.0 SDK introduces a new API for initialization called [[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig completion:nil]. This API is required for a number of new functionalities, including GDPR consent mechanisms and rewarded video. If you have been using [[MoPub sharedInstance] initializeRewardedVideoWithGlobalMediationSettings], it is now part of the new initialization, so make sure to switch to the new API.


You only need to initialize once using any valid ad unit ID from your app. Ad requests should only be made once the SDK initialization has completed.

  1. In your app’s didFinishLaunchingWithOptions:, instantiate a MPMoPubConfiguration with any valid ad unit ID from your app, your mediation settings (optional), and/or a list of mediated rewarded video adapters (optional).
  2. Call initializeSdkWithConfiguration: and pass in your MPMoPubConfiguration instance.


MPMoPubConfiguration *sdkConfig = [[MPMoPubConfiguration alloc] initWithAdUnitIdForAppInitialization:@"AD_UNIT_ID"];

sdkConfig.globalMediationSettings = @[];

Class<MPMediationSdkInitializable> adMob = NSClassFromString(@"MPGoogleAdMobRewardedVideoCustomEvent");
if (adMob != nil) {
  sdkConfig.mediatedNetworks = @[admob];

[[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig completion:nil]

Last updated December 05, 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.