Ios7 iAd显示白色框

Ios7 iAd显示白色框,ios7,iad,Ios7,Iad,我对iAd有点问题。有时它会显示一个空白的白色框。当我尝试使用Admob时,它工作得非常好。有时横幅正确地来自按钮,但有时它会立即显示白色框。问题是什么 这是我的密码: -(void)viewDidLayoutSubviews { if (self.view.frame.size.height != self.iAdBannerView.frame.origin.y) { self.iAdBanner

我对iAd有点问题。有时它会显示一个空白的白色框。当我尝试使用Admob时,它工作得非常好。有时横幅正确地来自按钮,但有时它会立即显示白色框。问题是什么

这是我的密码:

    -(void)viewDidLayoutSubviews
    {
        if (self.view.frame.size.height != self.iAdBannerView.frame.origin.y)
                    {
            self.iAdBannerView.frame = CGRectMake(0.0, self.view.frame.size.height, self.iAdBannerView.frame.size.width, self.iAdBannerView.frame.size.height);
                                    iAdBannerView.requiredContentSizeIdentifiers= [NSSet setWithObjects: ADBannerContentSizeIdentifierLandscape,nil];
                        iAdBannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
                    }

            if (self.view.frame.size.height != self.gAdBannerView.frame.origin.y)
            {
                self.gAdBannerView.frame = CGRectMake(150, self.view.frame.size.height, self.gAdBannerView.frame.size.width, self.gAdBannerView.frame.size.height);
            }

// Hide the banner by sliding down
-(void)hideBanner:(UIView*)banner
{
    if (banner && ![banner isHidden])
    {
        [UIView beginAnimations:@"hideBanner" context:NULL];
        banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);
        [UIView commitAnimations];
        banner.hidden = TRUE;
    }
}

// Show the banner by sliding up
-(void)showBanner:(UIView*)banner
{
    if (banner && [banner isHidden])
    {
        [UIView beginAnimations:@"showBanner" context:NULL];
        banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);
        [UIView commitAnimations];
        banner.hidden = FALSE;
    }
}

#pragma mark - ADBanner delegate methods -

// Called before the add is shown, time to move the view
- (void)bannerViewWillLoadAd:(ADBannerView *)banner
{
    NSLog(@"iAd load");
    [self hideBanner:self.gAdBannerView];
    [self showBanner:self.iAdBannerView];
}

// Called when an error occured
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    NSLog(@"iAd error: %@", error);
    [self hideBanner:self.iAdBannerView];
    [self.gAdBannerView loadRequest:[GADRequest request]];
}

iAds并不总是加载广告。当广告加载成功时,有一个委托方法让您知道


是否已
bannerViewDidLoadAd:
bannerView:didFailToReceiveAdWithError:

我已添加委托头正在调用的委托方法?广告正确显示和不正确显示之间有什么不同吗?你看了吗?如果广告正确显示,横幅会从底部滑动,如果广告不正确显示,横幅底部会有一个白色框,几秒钟后,它会用iAd测试文本填充。另一个解决方案对我不起作用:(我认为现在的情况是,你既没有收到广告也没有收到失败,因此你什么也看不到。当横幅被隐藏时,你需要在该空间中放置一些东西,并将其初始化为该状态。