Interstitial Ad
1. Basic requirements
Add ADX iOS SDK to your project.
Use the Ad Unit ID issued for Interstitial Ads.
Before requesting an ad, SDK initialization must be done first.
SDK initialization should be called only once when the app launches and ad requests should be made after SDK initialization is complete.
For iOS 14 and later, request ads only after obtaining ATT (App Tracking Transparency) permission.
2. Implementation
Instantiate an
ADXInterstitialAdusing theinitWithAdUnitId:method and register theADXInterstitialAdDelegatecallbacks.Call
loadAdto request an ad.Check whether an ad is available using
isLoaded, and if so, display the ad withshowAdFromRootViewController:
#import <ADXLibrary/ADXInterstitialAd.h>
@interface InterstitialViewController () <ADXInterstitialAdDelegate>
@property (strong) ADXInterstitialAd *interstitialAd;
@end
@implementation InterstitialViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.interstitialAd = [[ADXInterstitialAd alloc]
initWithAdUnitId:@"<ADX_INTERSTITIAL_AD_UNIT_ID>"];
self.interstitialAd.delegate = self;
}
- (IBAction)loadAd:(id)sender {
[self.interstitialAd loadAd];
}
- (IBAction)showAd:(id)sender {
if (self.interstitialAd.isLoaded) {
[self.interstitialAd showAdFromRootViewController:self];
}
}
#pragma mark - ADXInterstitialAdDelegate
- (void)interstitialAdDidLoad:(ADXInterstitialAd *)interstitial {
NSLog(@"interstitialAdDidLoad");
}
- (void)interstitialAd:(ADXInterstitialAd *)interstitialAd didFailToLoadWithError:(NSError *)error {
NSLog(@"interstitialAd:didFailToLoadWithError: %@", error);
}
- (void)interstitialAd:(ADXInterstitialAd *)interstitialAd didFailToShowWithError:(NSError *)error {
NSLog(@"interstitialAd:didFailToShowWithError: %@", error);
}
- (void)interstitialAdWillPresentScreen:(ADXInterstitialAd *)interstitialAd {
NSLog(@"interstitialAdWillPresentScreen");
}
- (void)interstitialAdWillDismissScreen:(ADXInterstitialAd *)interstitialAd {
NSLog(@"interstitialAdWillDismissScreen");
}
- (void)interstitialAdDidDismissScreen:(ADXInterstitialAd *)interstitialAd {
NSLog(@"interstitialAdDidDismissScreen");
}
- (void)interstitialAdDidClick:(ADXInterstitialAd *)interstitialAd {
NSLog(@"interstitialAdDidClick");
}
@end3. Callback
You can receive interstitial ad events through the ADXInterstitialAdDelegate.
4. Ad Revenue (paidEventHandler)
You can check the estimated ad revenue for ad impressions.
Last updated
Was this helpful?