Skip to main content

插屏广告

插屏广告#

  • 插屏广告一般是全屏的,调用时机是在页面切换时,一般有图片和视频两种,部分渠道会有定制化的插屏
  • 插屏广告是三方广告平台提供的一般不支持做定制或者修改
  • 插屏广告一般需要预加载,在展示机会到来时判断isAdReady()是否准备好,准备好后可以调用展示广告

集成说明#

1. 初始化#

#import <TradPlusAds/TradPlusAdInterstitial.h>
//初始化广告位
self.interstitial = [[TradPlusAdInterstitial alloc] init];
//设置回调
self.interstitial.delegate = self;
//设置广告位ID
[self.interstitial setAdUnitID:@"您的广告位ID"];

2. 显示广告#

//判断是否有可用广告
if (self.interstitialAd.isAdReady)
{
//sceneId为广告场景ID
[self.interstitial showAdWithSceneId:nil];
}

3. 加载广告#

[self.interstitialAd loadAd];

4. 监听回调#

  • 回调信息说明

  • tpInterstitialAdLoadFailWithError:返回的是TP封装的错误信息:详见: 错误码说明

  • tpInterstitialAdOneLayerLoad:didFailWithError: 返回三方源的错误信息

  • 以下回调接口已废弃v7.6.0+

- (void)tpInterstitialAdBidEnd:(NSDictionary *)adInfo success:(BOOL)successDEPRECATED_MSG_ATTRIBUTE("Please use tpInterstitialAdBidEnd:error:");
- (void)tpInterstitialAdLoadStart:(NSDictionary *)adInfo DEPRECATED_MSG_ATTRIBUTE("Please use tpInterstitialAdOneLayerStartLoad:");

回调接口及说明

///AD加载完成 首个广告源加载成功时回调 一次加载流程只会回调一次
- (void)tpInterstitialAdLoaded:(NSDictionary *)adInfo;
///AD加载失败
///tpInterstitialAdOneLayerLoaded:didFailWithError:返回三方源的错误信息
- (void)tpInterstitialAdLoadFailWithError:(NSError *)error;
///AD展现
- (void)tpInterstitialAdImpression:(NSDictionary *)adInfo;
///AD展现失败
- (void)tpInterstitialAdShow:(NSDictionary *)adInfo didFailWithError:(NSError *)error;
///AD被点击
- (void)tpInterstitialAdClicked:(NSDictionary *)adInfo;
///AD关闭
- (void)tpInterstitialAdDismissed:(NSDictionary *)adInfo;
@optional
///v7.6.0+ 开始加载流程
- (void)tpInterstitialAdStartLoad:(NSDictionary *)adInfo;
///v8.7.0+新增
///调用load之后如果收到此回调,说明广告位仍处于加载状态,无法触发新的一轮广告加载。
- (void)tpInterstitialAdIsLoading:(NSDictionary *)adInfo;
///当每个广告源开始加载时会都会回调一次。
///v7.6.0+新增。替代原回调接口:tpInterstitialAdLoadStart:(NSDictionary *)adInfo;
- (void)tpInterstitialAdOneLayerStartLoad:(NSDictionary *)adInfo;
///bidding开始
- (void)tpInterstitialAdBidStart:(NSDictionary *)adInfo;
///bidding结束 error = nil 表示成功
- (void)tpInterstitialAdBidEnd:(NSDictionary *)adInfo error:(NSError *)error;
///当每个广告源加载成功后会都会回调一次。
- (void)tpInterstitialAdOneLayerLoaded:(NSDictionary *)adInfo;
///当每个广告源加载失败后会都会回调一次,返回三方源的错误信息
- (void)tpInterstitialAdOneLayerLoad:(NSDictionary *)adInfo didFailWithError:(NSError *)error;
///加载流程全部结束
- (void)tpInterstitialAdAllLoaded:(BOOL)success;
///开始播放
- (void)tpInterstitialAdPlayStart:(NSDictionary *)adInfo;
///播放结束
- (void)tpInterstitialAdPlayEnd:(NSDictionary *)adInfo;

5. 进入广告场景#

广告场景调用时机和用途广告场景说明

[self.interstitial entryAdScenario:@"您的广告场景ID"];

6. 接入参考#

参考:TradPlusAdInterstitialViewController