Search...
Menu

App Open Ads

💡Tips

  • 🚀 Smart Cache automatically manages multi-placement parallel loading and cache comparison — no need to manually manage multiple MCAppOpenAd instances
  • ⚠️ MCAppOpenAdManager is a normal instance class; recommended to hold as a property; requires UIWindow and UIViewController for display
  • 🔧 Use setAppOpenContainerView: to set the container view and setLoadAdTimeout: to set load timeout

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

@interface SmartCacheAppOpenVC () <MCSmartCacheDelegate>

@property (nonatomic, strong) MCAppOpenAdManager *appOpenManager;

@end

@implementation SmartCacheAppOpenVC

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

    // (Optional) Set container view
    // [self.appOpenManager setAppOpenContainerView:containerView];

    // (Optional) Set load timeout in seconds (recommended 5-10 seconds)
    // [self.appOpenManager setLoadAdTimeout:5.0];

    [self.appOpenManager 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 App Open; implement as empty
- (void)smartCacheDidRewardUserForAd:(MCAdInfo *)ad withReward:(MCReward *)reward { }
- (void)smartCacheDidAdVideoStarted:(MCAdInfo *)ad { }
- (void)smartCacheDidAdVideoCompleted:(MCAdInfo *)ad { }

objective-c Copy
if ([self.appOpenManager isReady]) {
    // window can be nil to use key window; viewController can be nil for top-level VC
    [self.appOpenManager showAdWithWindow:nil viewController:self];
}

To pass a scene ID or other extra parameters:

objective-c Copy
if ([self.appOpenManager isReady]) {
    [self.appOpenManager showAdWithWindow:nil
                           viewController:self
                                withExtra:@{kMCAPIPlacementScenarioIDKey: @"your scene id"}];
}

3. Release Resources

objective-c Copy
[self.appOpenManager 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.appOpenManager) {
        self.appOpenManager = [[MCAppOpenAdManager alloc] init];
    }
    self.appOpenManager.delegate = self;

    // (Optional) Set container view
    // [self.appOpenManager setAppOpenContainerView:containerView];

    // (Optional) Set load timeout in seconds
    // [self.appOpenManager setLoadAdTimeout:5.0];

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

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

    [self.appOpenManager loadAd];
}

MCAppOpenAdManager-Specific API

Method Description
setAppOpenContainerView: Set the App Open ad container view
setLoadAdTimeout: Set load timeout (NSTimeInterval, in seconds; recommended 5-10 seconds)
Last modified: 2026-04-03Powered by