问题
I just published an application on the App Store with an iAd banner. When I downloaded it to check for the advertisement, I just saw a plain white horizontal rectangle even though it says "Live: This app is receiving live ads." in development.
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
[adView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
[adView setDelegate:self];
[self.view addSubview:adView];
[self.view bringSubviewToFront:adView];
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
return YES;
}
Everything in my performance chart is zero, except for the 715 requests. What does this mean?
Also, is it possible for iAd to determine the user's location so that apple can put ads from local companies? For example, the user is in Japan, will iAd only show ads from Japan?
回答1:
Does it work in the simulator, i don't think it's a programming error but rather a technical error from apples side. Manny developers is experiencing this: Can not see iAd in program?
回答2:
I think there is no ad available so your app receives a nil
value. I don't see any check for that, so regardless if it's nil or not, your app tries to display what it got, which may be nil. So you end up with a blank ad with no link what you see there.
I suggest in the next version to check for that and/or use some fallback method like AdMob or something.
回答3:
You need to check if your ADBannerView
received an ad or not and then display or hide it accordingly.
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
// Display banner
adView.alpha = 1.0;
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
// Hide banner
adView.alpha = 0.0;
}
来源:https://stackoverflow.com/questions/11894358/implementing-iad-banner