Search...
Menu

Interstitial Ads

💡Tips

  • 🚀 Smart Cache automatically manages multi-placement parallel loading and cache comparison — no need to manually manage multiple MCInterstitialAd instances
  • ⚠️ MCInterstitialAdManager is a normal instance class; recommended to hold as a property
  • 🔧 SDK auto-replenishes after display; simply check isReadyshowAd again to reuse

objective-c Copy
#import <MCSDK/MCSDK.h>

@interface SmartCacheInterstitialVC () <MCSmartCacheDelegate>

@property (nonatomic, strong) MCInterstitialAdManager *interstitialManager;

@end

@implementation SmartCacheInterstitialVC

#pragma mark - Load Ad
- (void)loadAd {
    if (!self.interstitialManager) {
        self.interstitialManager = [[MCInterstitialAdManager alloc] init];
    }
    // Set delegate before the first loadAd call
    self.interstitialManager.delegate = self;
    [self.interstitialManager loadAd];
}

#pragma mark - MCSmartCacheDelegate
// At least one ad in cache pool is ready
- (void)smartCacheDidLoadAd:(MCAdInfo *)ad {

}

// All placements failed in first round (mutually exclusive with smartCacheDidLoadAd:)
- (void)smartCacheDidFailToLoadAdWithError:(MCError *)error {

}

// Current round loading completed
- (void)smartCacheDidAdLoadFinished {

}

// Ad displayed successfully
- (void)smartCacheDidDisplayAd:(MCAdInfo *)ad {

}

// Ad closed; SDK auto-replenishes
- (void)smartCacheDidHideAd:(MCAdInfo *)ad {

}

// Ad clicked
- (void)smartCacheDidClickAd:(MCAdInfo *)ad {

}

// Ad display failed
- (void)smartCacheDidFailToDisplayAd:(MCAdInfo *)ad withError:(MCError *)error {

}

// Revenue callback
- (void)smartCacheDidPayRevenueForAd:(MCAdInfo *)ad {

}

// Rewarded video exclusive callbacks — not triggered for interstitial; implement as empty
- (void)smartCacheDidRewardUserForAd:(MCAdInfo *)ad withReward:(MCReward *)reward { }
- (void)smartCacheDidAdVideoStarted:(MCAdInfo *)ad { }
- (void)smartCacheDidAdVideoCompleted:(MCAdInfo *)ad { }

objective-c Copy
if ([self.interstitialManager isReady]) {
    // Pass the current top-level VC; can be nil for SDK default behavior
    [self.interstitialManager showAdWithViewController:self];
}

To pass a scene ID or other extra parameters:

objective-c Copy
if ([self.interstitialManager isReady]) {
    [self.interstitialManager showAdWithViewController:self
                                             withExtra:@{kMCAPIPlacementScenarioIDKey: @"your scene id"}];
}

3. Release Resources

objective-c Copy
[self.interstitialManager destroyAd];

Call destroyAd when the page or module is destroyed to release cache pool resources and avoid memory leaks. After release, loadAd must be called again to continue using.


4. Custom Parameter Configuration

objective-c Copy
- (void)loadAd {
    if (!self.interstitialManager) {
        self.interstitialManager = [[MCInterstitialAdManager alloc] init];
    }
    self.interstitialManager.delegate = self;

    // Set load extra parameters; call before loadAd
    [self.interstitialManager setLoadExtraParameter:@{
        @"userData": @"test_userData"
    }];

    // Set mediation extra parameters; call before loadAd
    [self.interstitialManager setExtraParameter:@{
        @"test_extra_key": @"test_extra_value"
    }];

    [self.interstitialManager loadAd];
}
Last modified: 2026-04-03Powered by