MPInterstitialAdController /1.11.1.0

global class MPInterstitialAdController

The MPInterstitialAdController class provides a full-screen advertisement that can be displayed during natural transition points in your application.

Public Properties

Setting and Getting the Delegate

MPInterstitialAdControllerDelegate/delegate /+1.11.1.0

  • Description: The delegate (MPInterstitialAdControllerDelegate) of the interstitial ad object.

  • Declaration:

    @property (readwrite, nonatomic) id<MPInterstitialAdControllerDelegate> delegate;
    
  • Parameters: None.

Setting Request Parameters

NSString/adUnitId /+1.11.1.0

  • Description: The MoPub ad unit ID for this interstitial ad. Ad unit IDs are created on the MoPub website. An ad unit is a defined placement in your application set aside for advertising. If no ad unit ID is set, the ad object will use a default ID that only receives test ads.

  • Declaration:

    @property (readwrite, copy, nonatomic) NSString *adUnitId;
    
  • Parameters: None.

NSString/keywords /+1.11.1.0

  • Description: A string representing a set of non-personally identifiable keywords that should be passed to the MoPub ad server to receive more relevant advertising. Note that if a user is in General Data Protection Regulation (GDPR) region and MoPub doesn’t obtain consent from the user, “keywords” will still be sent to the server.

  • Declaration:

    @property (readwrite, copy, nonatomic) NSString *keywords;
    
  • Parameters: None.

NSString/userDataKeywords /+5.4.0

  • Description: A string representing a set of personally identifiable keywords that should be passed to the MoPub ad server to receive more relevant advertising. Keywords are typically used to target ad campaigns at specific user segments. They should be formatted as comma-separated key-value pairs (for example, marital:single,age:24). Refer to our documentation about keyword targeting options. Note that if a user is in General Data Protection Regulation (GDPR) region and MoPub doesn’t obtain consent from the user, personally identifiable keywords will not be sent to the server.

  • Declaration:

    @property (readwrite, copy, nonatomic) NSString *userDataKeywords;
    
  • Parameters: None.

CLLocation/location /+1.11.1.0-5.12.0

  • Description: A CLLocation object representing a user’s location that should be passed to the MoPub ad server to receive more relevant advertising.

  • Declaration:

    @property (readwrite, copy, nonatomic) CLLocation *location;
    
  • Parameters: None.

NSDictionary/localExtras /+5.4.0

  • Description: An optional dictionary containing extra local data.

  • Declaration:

    @property (readwrite, copy, nonatomic) NSDictionary *localExtras;
    
  • Parameters: None.

Detecting Whether the Interstitial Ad Has Loaded

/ready /+1.11.1.0

  • Description: A Boolean value that represents whether the interstitial ad has loaded an advertisement and is ready to be presented. After obtaining an interstitial ad object, you can use loadAd to tell the object to begin loading ad content. Once the content has been loaded, the value of this property will be YES. The value of this property can be NO if the ad content has not finished loading, has already been presented, or has expired. The expiration condition only applies for ads from certain third-party ad networks. See MPInterstitialAdControllerDelegate for more details.

  • Declaration:

    @property (readonly, assign, nonatomic) BOOL ready;
    
  • Parameters: None.

Public Methods

Obtaining an Interstitial Ad

+/interstitialAdControllerForAdUnitId: /+1.11.1.0

  • Description: Returns an interstitial ad object matching the given ad unit ID. The first time this method is called for a given ad unit ID, a new interstitial ad object is created, stored in a shared pool, and returned. Subsequent calls for the same ad unit ID will return that object, unless you have disposed of the object using removeSharedInterstitialAdController:. There can only be one interstitial object for an ad unit ID at a given time.

  • Declaration:

    + (MPInterstitialAdController *)interstitialAdControllerForAdUnitId:
        (NSString *)adUnitId;
    
  • Parameters:

    • adUnitId: A string representing a MoPub ad unit ID.

Loading an Interstitial Ad

-/loadAd /+1.11.1.0

Presenting an Interstitial Ad

-/showFromViewController: /+1.11.1.0

  • Description: Presents the interstitial ad modally from the specified view controller. This method will do nothing if the interstitial ad has not been loaded (that is, if the value of its ready property is NO). MPInterstitialAdControllerDelegate provides optional methods that you may implement to stay informed about when an interstitial takes over or relinquishes the screen.

  • Declaration:

    - (void)showFromViewController:(UIViewController *)controller;
    
  • Parameters:

    • controller: The view controller that should be used to present the interstitial ad.

Disposing of an Interstitial Ad

+/removeSharedInterstitialAdController: /+1.11.1.0

  • Description: Removes the given interstitial object from the shared pool of interstitials available to your application. This method removes the mapping from the interstitial ad’s ad unit ID to the interstitial ad object. In other words, you will receive a different ad object if you subsequently call interstitialAdControllerForAdUnitId: for the same ad unit ID. Important: This method is intended to be used for deallocating the interstitial ad object when it is no longer needed. You should nil out any references you have to the object after calling this method.

  • Declaration:

    + (void)removeSharedInterstitialAdController:
        (MPInterstitialAdController *)controller;
    
  • Parameters:

    • controller: The interstitial ad object that should be disposed.

Last updated July 10, 2020

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.

© 2020 MoPub (a division of Twitter, Inc.)