简体   繁体   English

iAd显示不正确

[英]iAd doesn't shows correct

i'm developing dict for iOS, and try to use iAd for monetization. 我正在为iOS开发dict,并尝试使用iAd获利。 I done step by step with examples, except creating ad view, but ad doesn't show correct. 除了创建广告视图外,我逐步完成了示例,但广告显示不正确。

开始画面

广告已加载

视图控制器

my code: 我的代码:

- (void)viewDidLoad
{
    adView.frame = CGRectOffset(adView.frame, 0, -50); //don't work
    adView.delegate=self;
    self.bannerIsVisible=NO;
    [super viewDidLoad];
}
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
    if (!self.bannerIsVisible){
        [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
        banner.frame = CGRectOffset(banner.frame, 0, 50); //works well
        [UIView commitAnimations];
        self.bannerIsVisible = YES;
    }
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
    if (self.bannerIsVisible){
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        banner.frame = CGRectOffset(banner.frame, 0, -50);
        [UIView commitAnimations];
        self.bannerIsVisible = NO;
    }
}

I work with storyboard, using autolayout, tried to set 我使用情节提要,使用自动布局,试图设置

self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

Nothing helped. 没有任何帮助。

Is it showing in the wrong position, or just not showing the ad when built in release mode? 是在内置发布模式下显示的位置错误还是只是不显示广告? If it is in the wrong position, don't use the autoresizingMask and use the autolayout constraints in the storyboard instead. 如果位置错误,请不要使用autoresizingMask,而应使用情节提要中的自动布局约束。 If it is not showing up after building in release/submitting to app store, then you most likely still need to register for the iAd network through iTunesConnect. 如果在构建发行版/提交到应用商店后未显示,则您很可能仍需要通过iTunesConnect注册iAd网络。

It looks like you are using iOS 7. There is a really easy way to add iAds if you don't mind it showing up on the bottom of the view: 看来您使用的是iOS7。如果您不介意iAds出现在视图底部,则有一种添加iAd的非常简单的方法:

#import <iAd/iAd.h>

yourViewController.canDisplayBannerAds = YES;

You do not need to implement any other show/hide methods if you use this property. 如果使用此属性,则无需实现任何其他show / hide方法。 Apple's WWDC 2013 video titled "iAd Integration and Best Practices" explains this in detail: Apple的WWDC 2013视频标题为“ iAd集成和最佳实践”,详细说明了这一点:

https://developer.apple.com/wwdc/videos/ https://developer.apple.com/wwdc/videos/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM