Interstitial Ad
Add Files for Interstitial Ad Integration
Add CESplash2AD.h CESplash2AD.m
to your app's build target.
Request Interstitial Ad
Import
CESplash2AD.h
and adoptCESplash2ADRequestDelegate
protocol in view controller's extension.
// MyViewController.m
#import "CESplash2AD.h"
@interface MyViewController() <CESplash2ADRequestDelegate>
Create a CESplash2AD instance and keep its reference. Load ad with your CESplash2AD instance.
@interface MyViewController() <CESplash2ADRequestDelegate>
@property (nonatomic, strong) CECSplash2AD *splashAd;
@end
- (void) viewDidLoad()
{
CERequestInfo *info = [CERequestInfo new];
info.placement = @"PUT_YOUR_PLACEMENT_STRING_HERE·";
info.timeout = 5;
self.splashAD = [[CESplash2AD alloc] initWithVideoViewProfile:CEVideoViewProfileSplash2DefaultProfile];
[self.splashAD loadAdAsyncWithInfo:info reqDelegate:self];
}
Implement
splash2ADDidLoaded:splash2AD
to handle ad loaded event.
#pragma mark - CESplash2ADRequestDelegate
- (void)splash2ADDidLoaded:(CESplash2AD*)splash2AD
{
UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
while (topController.presentedViewController) {
topController = topController.presentedViewController;
}
[splash2AD showFromViewController:topController animated:YES];
}
Add CESplashADEventDelegate
to get the ad event callback.
CESplashADEventDelegate
to get the ad event callback.If you want to trace the click, impression, progress event, please implement CESplashADEventDelegate
to handle it.
#pragma mark - CESplash2ADEventDelegate
/*!
* @brief protocol of CESplash2ADEventDelegate that can receive AD events
*/
@protocol CESplash2ADEventDelegate <NSObject>
@optional
/*!
* @brief callback while this splash2 ad is clicked by user
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADDidClick:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback while splash2 ad is about to log impression
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADWillTrackImpression:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback while this splash2 ad is video format and muted.
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADDidMute:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback while this splash2 ad is video format and unmuted.
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADDidUnmute:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback while this splash2 ad is video format and start playback.
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADDidVideoStart:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback while this splash2 ad is video format and playback to end.
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADDidVideoEnd:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback while this splash2 ad is video format and progress state.
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
* @param totalDuration this video total duration time (ms)
* @param currentPosition this video current play back position time (ms)
*/
- (void) splash2ADDidVideoProgress:(nonnull CESplash2AD *)splash2AD
duration:(int)totalDuration
position:(int)currentPosition;
/*!
* @brief callback function while splash2 AD did display from screen
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADDidDisplayed:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback function while splash2 AD did dismiss from screen
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADDidDismiss:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback function while splash2 AD will display to screen
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADWillDisplay:(nonnull CESplash2AD *)splash2AD;
/*!
* @brief callback function while splash2 AD will dismiss from screen
*
* @param splash2AD CESplash2AD instance that own this splash2 ad component
*/
- (void) splash2ADWillDismiss:(nonnull CESplash2AD *)splash2AD;
@end
Last updated