Skip to main content

Splash

1. Load an ad#

  • Splash ads are generally used with the app's launch page. Show the launch page to the user while loading, and then show the ad after the ad is successfully loaded. After the ad is over, enter the app.
  • AdUnitID is the ad unit ID created in the TradPlus background. The SDK will pull the configuration and request the ad according to the ad unit ID.
#import <TradPlusAds/TradPlusAdSplash.h>
self.splashAd = [[TradPlusAdSplash alloc] init];
[self.splashAd setAdUnitID:@"Your ad unit ID"];
self.splashAd.delegate = self;
[self.splashAd loadAdWithWindow:window bottomView:view];

2. Show Splash Ad#

  • During cold start, try not to request other network resources at the same time. When you receive the loaded callback, show the ad immediately.
  • During hot start, you can preload the ad. When listening to the device switch foreground event, call the isAdReady method to check if there is an available ad. When there is an available ad, call the show method to show the ad.
if (self.splashAd.isAdReady)
{
[self.splashAd show];
}

3. Register TradPlusADSplashDelegate Callback#

  • Ad event callbacks need to be registered before displaying an ad. Get callbacks for ad loading, ad show, ad click, ad close, etc.
//Ad loaded successfully. Callback when the first ad source is loaded successfully. The loading process will only be called once
- (void)tpSplashAdLoaded:(NSDictionary *)adInfo;
//Ad loading failed
///tpSplashAdOneLayerLoad:didFailWithError:Returns the error message of the third-party source
- (void)tpSplashAdLoadFailWithError:(NSError *)error;
//Ad show succeeded. Valid show recognized by the third party
- (void)tpSplashAdImpression:(NSDictionary *)adInfo;
//Ad show failed
- (void)tpSplashAdShow:(NSDictionary *)adInfo didFailWithError:(NSError *)error;
//Ad clicked
- (void)tpSplashAdClicked:(NSDictionary *)adInfo;
//Ad closed
- (void)tpSplashAdDismissed:(NSDictionary *)adInfo;

4. Integration Reference#

Reference: TradPlusAdSplashViewController