插屏广告接入代码

1. 包含头文件 AdHubSDK.h

2. AdHubInterstitial 的创建和初始化

// 插屏广告的创建与初始化
self.interstitial = [[AdHubInterstitial alloc] initWithSpaceID:[DemoIDData sharedInstance].interstitialSpaceID spaceParam:[DemoIDData sharedInstance].interstitialSpaceParam];
self.interstitial.delegate = self;
// 插屏广告请求开始
[self.interstitial loadAd];

3. AdHubInterstitial 主要属性说明

//广告位 id 在AdHub后台创建产生
@property(nonatomic, readonly, copy) NSString *spaceID;
//填写任意字符串
@property(nonatomic, readonly, copy) NSString *spaceParam;
/**
 presentViewController:animated:
 默认 YES
 */
@property(nonatomic,assign)BOOL needAnimation;

/**
 用来接收插屏广告读取和展示状态变化通知的 delegate
 */
@property(nonatomic, weak) id<AdHubInterstitialDelegate> delegate;

4. AdHubInterstitial 展现方法

/**
 展示插屏
 @param rootViewController 用于展示插屏的 viewController。展示结束后,delegate 的 interstitialDidDismissScreen: 方法将会被调用
 */
- (void)presentFromRootViewController:(UIViewController *)rootViewController;

5. AdHubInterstitialDelegate 的方法说明

@optional
/**
 插屏请求成功
 */
- (void)interstitialDidReceiveAd:(AdHubInterstitial *)ad;

/**
 插屏请求失败
 */
- (void)interstitial:(AdHubInterstitial *)ad didFailToReceiveAdWithError:(AdHubRequestError *)error;

/**
 插屏展现
 */
- (void)interstitialDidPresentScreen:(AdHubInterstitial *)ad;

/**
 插屏点击 landingPageURL 为空时说明有详情页
 点击广告, 手动调用 interstitialCloseAdCloseAd 会移除当前广告展示
 */
- (void)interstitialDidClick:(NSString *)landingPageURL;

/**
 插屏关闭
 */
- (void)interstitialDidDismissScreen:(AdHubInterstitial *)ad;

results matching ""

    No results matching ""