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 ad initialization and pre-loading using the – loadWithRequest: method.

    Use the YMAAdRequest class to transmit the code received in the ADFOX interface (for more information, see the Help for ADFOX Mobile).
    // Code from the ADFOX interface for working with direct campaigns.
    NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
    parameters[@"adf_ownerid"] = @"<example>";
    parameters[@"adf_p1"] = @"<example>";
    parameters[@"adf_p2"] = @"<example>";
    parameters[@"adf_pfc"] = @"<example>";
    parameters[@"adf_pfb"] = @"<example>";
    parameters[@"adf_pt"] = @"<example>";
    parameters[@"adf_pd"] = @"<example>";
    parameters[@"adf_pw"] = @"<example>";
    parameters[@"adf_pv"] = @"<example>";
    parameters[@"adf_prr"] = @"<example>";
    parameters[@"adf_pdw"] = @"<example>";
    parameters[@"adf_pdh"] = @"<example>";
    YMAAdRequest *adRequest = [[YMAAdRequest alloc] initWithLocation:nil
    self.interstitialAd =
        [[YMAInterstitialController alloc] initWithBlockID:<your unique BlockID>];
    self.interstitialAd.delegate = self;
    [self.interstitialAd loadWithRequest:adRequest];
  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