开屏广告是app启动时,显示的一种广告形式。
属性 | 说明 |
---|---|
adConfiguration | 广告配置对象 |
delegate | 广告代理声明 |
方法 | 说明 |
---|---|
initWithAdConfiguration: | 创建初始化对象adConfiguration 广告配置 |
loadSplashAd | 广告请求 |
showSplashViewInWindow: | 显示广告 |
showSplashViewInWindow:bottomView: | 显示广告并设置LogoView |
removeSplashAd | 销毁开屏广告对象 |
方法 | 说明 |
---|---|
ampsSplashAdLoadSuccess: | 开屏广告加载成功 |
ampsSplashAdLoadFail: error: | 开屏广告加载失败 |
ampsSplashAdRenderSuccess: | 开屏广告渲染成功 |
ampsSplashAdRenderFail: error: | 开屏广告渲染失败 |
ampsSplashAdDidShow: | 开屏广告显示 |
ampsSplashAdShowFail: error: | 开屏广告显示失败 |
ampsSplashAdExposured: | 开屏广告曝光 |
ampsSplashAdDidClick: | 开屏广告点击 |
ampsSplashAdDidClose: | 开屏广告关闭 |
广告加载与显示:
#import <AMPSAdSDK/AMPSAdSDK.h>
@interface AppDelegate ()<AMPSSplashAdDelegate>
@property (nonatomic, strong) AMPSSplashAd *splash;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[AMPSAdSDKManager sharedInstance]startAsyncWithAppId:kAdScopeDemoADNInitSDKAPPID configuration:nil results:^(AMPSAdSDKInitStatus statusResult) {
[self requestSplashAd];
}];
return YES;
}
- (void)requestSplashAd {
[self.view endEditing:YES];
AMPSAdConfiguration *cfg = [[AMPSAdConfiguration alloc]init];
cfg.spaceId = @"广告位ID";
self.splashAd = [[AMPSSplashAd alloc]initWithAdConfiguration:cfg];
self.splashAd.delegate = self;
[self.splashAd loadSplashAd];
}
- (void)ampsSplashAdLoadSuccess:(AMPSSplashAd *)splashAd {
CookieADNLog(@"ampsSplashAdLoadSuccess");
}
- (void)ampsSplashAdLoadFail:(AMPSSplashAd *)splashAd error:(NSError *_Nullable)error {
CookieADNLog(@"ampsSplashAdLoadFail:%@", error);
}
- (void)ampsSplashAdRenderFail:(AMPSSplashAd *)splashAd error:(NSError * _Nullable)error {
CookieADNLog(@"ampsSplashAdRenderFail:%@", error);
}
- (void)ampsSplashAdRenderSuccess:(AMPSSplashAd *)splashAd {
CookieADNLog(@"ampsSplashAdRenderSuccess");
UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kAdScopeDemoScreenWidth, 160)];
bottomView.backgroundColor = [UIColor adScopeColorWithHexString:@"#6495ED"];
[self.splash showSplashViewInWindow:[UIApplication sharedApplication].keyWindow bottomView:bottomView];
}
- (void)ampsSplashAdDidShow:(AMPSSplashAd *)splashAd {
CookieADNLog(@"ampsSplashAdDidShow");
}
- (void)ampsSplashAdExposured:(AMPSSplashAd *)splashAd {
CookieADNLog(@"ampsSplashAdExposured");
}
- (void)ampsSplashAdDidClick:(AMPSSplashAd *)splashAd {
CookieADNLog(@"ampsSplashAdDidClick");
}
- (void)ampsSplashAdDidClose:(AMPSSplashAd *)splashAd {
CookieADNLog(@"ampsSplashAdDidClose");
}
- (void)ampsSplashAdShowFail:(AMPSSplashAd *)splashAd error:(NSError * _Nullable)error {
CookieADNLog(@"ampsSplashAdShowFail:%@", error);
}
/**
本次广告价格,单位分
*/
- (NSInteger)eCPM;
/**
@pararm winInfo 竞胜信息,字典类型
AMPS_WIN_PRICE :竞胜价格 (单位: 分),必填
AMPS_WIN_ADNID :竞胜渠道ID,必填
AMPS_HIGHRST_LOSS_PRICE :失败渠道中最高价格,必填
AMPS_EXPECT_PRICE :期望价格,选填
*/
- (void)sendWinNotificationWithInfo:(NSDictionary *)winInfo;
/**
@pararm lossInfo 竞败信息,字典类型
AMPS_WIN_PRICE :竞胜价格 (单位: 分),必填
AMPS_WIN_ADNID :竞胜渠道ID,必填
AMPS_HIGHRST_LOSS_PRICE :失败渠道中最高价格,必填
AMPS_LOSS_REASON :失败原因,必填
AMPS_EXPECT_PRICE :期望价格,选填
*/
- (void)sendLossNotificationWithInfo:(NSDictionary *)lossInfo;
类型相关的枚举请参考:AMPSAdSDKDefines