I inserted the adBannerView in an iphone app. I follow the apple examples described on documentation. when App runs in debug mode the ads are shown correctly (Test version), but in the release version, when real users use the app I see a white box where it should be shown the banner.
Maybe I missed/forgot somehting or I made something wrong?
the view controller that shows the banner have an initBanner Method:
- (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;
}
the call start from:
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self initBanner];
}