【问题标题】:App rejected because of hidden whenever ad content is not being served by iAd每当 iAd 不提供广告内容时,应用因隐藏而被拒绝
【发布时间】:2012-11-15 16:42:27
【问题描述】:

我的应用刚刚被拒绝,因为“只要 iAd 不提供广告内容,应用内的横幅就应该隐藏。”然后他们提供这个示例代码;

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    if (self.bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        // assumes the banner view is at the top of the screen.
        banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);
        [UIView commitAnimations];
        self.bannerIsVisible = NO;
    }
}

现在我的 iAd 显示在屏幕底部而不是顶部。我还想计算 3.5 和 4 英寸的屏幕,所以这是我的代码;

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    if (self.bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];

        CGSize result = [[UIScreen mainScreen] bounds].size;
        CGFloat scale = [UIScreen mainScreen].scale;
        result = CGSizeMake(result.width * scale, result.height * scale);

        if(result.height == 1136){
            banner.frame = CGRectOffset(banner.frame, 498, -banner.frame.size.height);
        }else{
            banner.frame = CGRectOffset(banner.frame, 410, -banner.frame.size.height);
        }

        [UIView commitAnimations];
        self.bannerIsVisible = NO;
    }
}

真正烦人的是我的代码在我的测试 iPhone 和 iOS 模拟器上都能正常运行。

我做错了什么?

【问题讨论】:

    标签: iphone xcode iad appstore-approval


    【解决方案1】:

    如果您的横幅位于底部,您应该求和 banner.frame.size.height 而不是减去以隐藏横幅。无需针对不同的屏幕进行额外的计算。

    所以,这就够了:

    banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);
    

    【讨论】:

      猜你喜欢
      • 2015-12-12
      • 2019-08-31
      • 2016-12-06
      • 2014-10-13
      • 2018-10-18
      • 1970-01-01
      • 2014-03-01
      • 1970-01-01
      • 2017-11-29
      相关资源
      最近更新 更多