Splash Ad

app_show_type: 60004

Import Header Files.

// if CheetahMobileAds.framework
@import CheetahMobileAds;

// else if CheetahMobileAds.a
#import <CMASplashAd.h>

Setup POSID and SplashAd

CMAPosIDConfig *config = [[CMAPosIDConfig alloc] 
        initWithOrionPosID:@"YOUR_POSID_FOR_GLOBAL" 
        liehuPosID:@"YOUR_POSID_FOR_CHINA"];
        
CMASplashAd *splashAd = [[CMASplashAd alloc] initWithPosIDConfig:config];
splashAd.dismissAnimation = kCMASplashAnimationGrowFade;
splashAd.backgroundView = [self splashBackgroundView];

Set up event notifications

// Have a delegate implmenetation .
@interface ViewController ()<CMASplashAdDelegate>

splashAd.delegate = self;

The following sample illustrates how to log each of the events available in CMASplashAdDelegate:

#pragma mark - 

- (void)splashAdDidLoadAd:(CMASplashAd *)splashAd;
{
    NSLog(@"Ad was loaded.");
}

- (void)splashAd:(CMASplashAd *)splashAd didFailToLoadAdWithError:(CMARequestError *)error;
{
    NSLog(@"didFailToLoadAdWithError %@", error);
}

- (void)splashAdWillSkip:(CMASplashAd *)splashAd
{
    NSLog(@"SplashAd skipped...");
}

- (void)splashAdWillPresentScreen:(CMASplashAd *)splashAd;
{
    NSLog(@"splashAdWillPresentScreen");
}

- (void)splashAdDidDismissScreen:(CMASplashAd *)splashAd;
{
    NSLog(@"splashAdDidDismissScreen");
}

- (void)splashAdWillLeaveApplication:(CMASplashAd *)splashAd;
{
    NSLog(@"splashAdWillLeaveApplication");    
}

@end

Show Ads

[splashAd show];

Last updated