Implementing iAd Banner

主宰稳场 提交于 2019-12-25 16:24:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!