iOS - ADBannerView未在应用上展示广告

时间:2016-04-06 13:28:23

标签: ios objective-c iphone iad adbannerview

我正在尝试在应用上展示广告。但它不起作用(在模拟器+设备上)。错误deatils: 错误:无法展示广告。错误:无法完成操作。广告已从此横幅中卸载

-(void)viewDidLoad {
[super viewDidLoad];
self.adBanner.delegate = self;
self.adBanner.alpha = 0.0;

}

-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
[UIView animateWithDuration:0.5 animations:^ {
    self.adBanner.alpha = 1.0;
}];

}

-(BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {
NSLog(@"Ad Banner action is about to begin.");
self.pauseTimeCounting = YES;
return YES;

}

-(void)bannerViewActionDidFinish:(ADBannerView *)banner {
NSLog(@"Ad Banner action did finish");
self.pauseTimeCounting = NO;

}

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
NSLog(@"Unable to show ads. Error: %@", [error localizedDescription]);
// Hide the ad banner.
[UIView animateWithDuration:0.5 animations:^ {
    self.adBanner.alpha = 0.0;
}];

}

1 个答案:

答案 0 :(得分:0)

如果没有要展示的广告,则会从视图中卸载adBanner。

转到iAd信息中心,按照说明操作,为您的应用启用一些广告。 (如果您尚未在Apple会员中心获得开发人员角色,请与开发人员联系,为您的应用设置广告。)

您的上次委托方法

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error

被调用,因为它找不到广告。

注意 - 在设备上测试不在模拟器上的广告。