示例代码如下:
#import "ViewController.h"
#import <VungleSDK/VungleSDK.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSError* error;
VungleSDK* sdk = [VungleSDK sharedSDK];
sdk.delegate=self;
[sdk startWithAppId:@"YOUR_APP_ID" error:&error];
}
// 实现的回调
- (void)vungleSDKDidInitialize{
// 初始化成功
}
- (void)vungleSDKFailedToInitializeWithError:(NSError *)error{
// 初始化失败
}
- (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(nullable NSString *)placementID error:(nullable NSError *)error{
// 缓存广告成功或失败
}
- (void)vungleWillShowAdForPlacementID:(nullable NSString *)placementID{
// 广告即将开始播放
}
- (void)vungleDidShowAdForPlacementID:(nullable NSString *)placementID{
// 广告开始播放
}
- (void)vungleTrackClickForPlacementID:(nullable NSString *)placementID{
// 广告被点击
}
- (void)vungleWillLeaveApplicationForPlacementID:(nullable NSString *)placementID{
// 离开应用,例如用户点击广告,跳转商店
}
- (void)vungleRewardUserForPlacementID:(nullable NSString *)placementID{
// 使用与奖励广告位,当用户观看80%以上时触发
}
- (void)vungleWillCloseAdForPlacementID:(nonnull NSString *)placementID{
// 用户点击关闭按钮,即将关闭广告
}
- (void)vungleDidCloseAdForPlacementID:(nonnull NSString *)placementID{
// 用户点击关闭按钮,关闭广告
}
- (void)vungleAdViewedForPlacement:(NSString *)placementID{
// 用户观看了一帧广告
}