我在iphone應用程序中插入了adBannerView。我遵循文檔中描述的蘋果示例。當應用程序在調試模式下運行時,廣告顯示正確(測試版本),但在發佈版本中,當真實用戶使用應用程序時,我看到一個白色框,它應該顯示橫幅。iOS - 在最終版本上未顯示ADBannerView
也許我錯過了/忘記了或者我做錯了什麼?
視圖控制器,顯示旗幟有一個initBanner方法:
- (void) initBanner{
ADBannerView *_bannerView = nil;
if (!is2ShowBanner){
_bannerView = nil;
MyLogEvidence(@"%@ BANNER da Nascondere", [self.class description]);
return;
}
MyLogEvidence(@"%@ BANNER da Visualizzare", [self.class description]);
_bannerView = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner];
[_bannerView setDelegate:self];
CGRect bounds = self.view.bounds ;
CGRect frame = _bannerView.frame;
frame.origin = CGPointMake(CGRectGetMinX(bounds),CGRectGetMaxY(bounds)- _bannerView.frame.size.height);
[_bannerView setFrame:frame];
[self.view addSubview:_bannerView];
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
[self layoutForBanner:banner animated:YES ];
}
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
[self layoutForBanner:banner animated:YES];
}
- (void)layoutForBanner:(ADBannerView*)_bannerView animated:(BOOL)animated
{
if (_bannerView == nil){
MyLog(@"BANNER non presente");
[_constraintVerticalForBanner setConstant:3.0];
[self.view layoutIfNeeded];
[self.view updateConstraintsIfNeeded];
return;
}
[_bannerView setHidden:!_bannerView.bannerLoaded];
[_constraintVerticalForBanner setConstant:_bannerView.hidden? 3.0 : _bannerView.frame.size.height+3];
[self.view layoutIfNeeded];
[self.view updateConstraintsIfNeeded];
MyLog(@"%@.constraintVerticalForBanner start: %3.0f",[self.class description],_constraintVerticalForBanner.constant);
}
-(BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave{
return YES;
}
呼叫開始從:
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self initBanner];
}
您是否在iTunes連接中啓用了廣告? – giorashc