Enabling interstitial ads

An interstitial ad is a configurable ad that covers the entire screen and responds to clicks.

To enable advertising:

  1. Add the import:

    #import <YandexMobileAds/YandexMobileAds.h>
  2. Create @property where the link to the banner ad will be stored:

    @property (nonatomic, strong) YMAInterstitialController *interstitialAd;
  3. Perform initialization and pre-loading of the ad. This must be performed after displaying the app interface.

    Optionally, you can use the YMAAdRequest class to transmit the data for targeting.

    self.interstitialAd = [[YMAInterstitialController alloc] initWithBlockID:<your unique BlockID>];
    self.interstitialAd.delegate = self;
    [self.interstitialAd load];

    BlockId is a unique identifier in the R-M-XXXXXX-Y format, which is assigned in the Partner interface.

    In addition, self must conform to the YMAInterstitialDelegate protocol. The ad must be pre-loaded in the same orientation as it will be shown (otherwise, the ad will not be shown because the banner size won't match the screen size).

  4. Start displaying ads by using this method:

    - (void)interstitialDidLoadAd:(YMAInterstitialController *)interstitial
             [interstitial presentInterstitialFromViewController:self];
  5. You can optionally enable logging by using the enableLogging method. If an impression wasn't registered, a message appears in the console.

To find out why ads aren't working correctly, use the method

- (void)interstitialDidFailToLoadAd:(YMAInterstitialController *)interstitial error:(NSError *)error;

For error descriptions, see YMAAdErrorCode.

To see how ads will be displayed in the app, use the sample Block ID:
  • R-M-DEMO-240x400-context
  • R-M-DEMO-400x240-context
  • R-M-DEMO-320x480
  • R-M-DEMO-480x320