激励视频广告接入代码

1. 包含头文件

#import <AdHubSDK/AdHubSDK.h>

2. 激励视屏广告的初始化与请求

// 设置激励视频的 delegate
[AdHubRewardBasedVideoAd sharedInstance].delegate = self;
// 激励视频请求开始
[[AdHubRewardBasedVideoAd sharedInstance] loadAdWithSpaceID:data.rewardVideoSpaceID spaceParam:data.rewardVideoSpaceParam];

3. 主要属性说明

//广告位 id 在AdHub后台创建产生
@property(nonatomic, readonly, copy) NSString *spaceID;
//填写任意字符串
@property(nonatomic, readonly, copy) NSString *spaceParam;

/**
 用来接收激励视频广告读取和展示状态变化通知的 delegate
 */
@property(nonatomic, weak) id<AdHubRewardBasedVideoAdDelegate> delegate;
/**
 激励视频是否加载完毕
 */
@property(nonatomic, readonly, getter=isReady) BOOL ready;

4. 激励视频广告的展示

/**
 展示激励视频广告

 @param rootViewController 用于展示激励视频的 viewController。展示结束后,delegate 的 rewardBasedVideoAdDidClose: 方法将会被调用
 */
- (void)presentFromRootViewController:(UIViewController *)rootViewController;

5. 代理方法说明

@required
/**
 奖励发生了
 */
- (void)rewardBasedVideoAd:(AdHubRewardBasedVideoAd *)rewardBasedVideoAd
    didRewardUserWithReward:(NSObject *)reward;
@optional
/**
 视频加载失败
 */
- (void)rewardBasedVideoAd:(AdHubRewardBasedVideoAd *)rewardBasedVideoAd
    didFailToLoadWithError:(NSError *)error;
/**
 视频加载完毕
 */
- (void)rewardBasedVideoAdDidReceiveAd:(AdHubRewardBasedVideoAd *)rewardBasedVideoAd;
/**
 视频被打开
 */
- (void)rewardBasedVideoAdDidOpen:(AdHubRewardBasedVideoAd *)rewardBasedVideoAd;
/**
 视频开始播放
 */
- (void)rewardBasedVideoAdDidStartPlaying:(AdHubRewardBasedVideoAd *)rewardBasedVideoAd;
/**
 视频关闭
 */
- (void)rewardBasedVideoAdDidClose:(AdHubRewardBasedVideoAd *)rewardBasedVideoAd;

results matching ""

    No results matching ""