【问题标题】:iAd device rotation causes 'may be obscured' warningiAd 设备旋转导致“可能被遮挡”警告
【发布时间】:2012-04-19 15:41:08
【问题描述】:

我有一个仅纵向/纵向颠倒的应用程序,我在其中实现了 iAds - 一切似乎都成功了,我实现它的页面只是一个图像视图和一堆按钮,所以我没有设置它当广告在主视图上方移动时移动,但如果我旋转设备,我得到横幅可能会被遮挡错误。

我只能在页面上的每个会话中收到一次错误,进一步的旋转不会导致重复,但如果我转到另一个页面并返回,我可以再次重复警告。

如果我让应用程序运行一段时间,广告会根据它们的可用性来来去去而没有警告 - 看起来好像没有广告叠加。

这可能是轮换期间发生的短暂故障吗?有什么方法可以进一步诊断吗?

我添加了 [self.view bringSubviewToFront:theBannerView];到动画阶段,但没有什么区别,这并不奇怪,因为它是轮换的问题!

【问题讨论】:

    标签: ios rotation warnings iad


    【解决方案1】:

    试试这个:

    - (void)changeBannerOrientation:(UIInterfaceOrientation)toOrientation
    {
    
        if (UIInterfaceOrientationIsLandscape(toOrientation)) {
            self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
        }
    
    else {
            self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
        }
    }
    
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
            return YES;
    }
    
    - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
                                duration:(NSTimeInterval)duration
    {
    
        if (bannerView) {
            [self changeBannerOrientation:toInterfaceOrientation];
        }
    }
    

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题。在屏幕方向更改期间,广告视图未完全显示在屏幕上,因此“横幅可能被遮挡”

      为了防止“错误”,您可以在旋转之前删除或隐藏广告视图,然后将其重新添加,

      - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
          [AFAddManager removeFromView];
      }
      - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
          [AFAddManager updateOrientation:self.interfaceOrientation];
          [AFAddManager addToView:self.view];
      }
      

      但这看起来不太好。您可以将 adview 替换为复制的图像,使其看起来像已旋转。

      我将带着警告消息离开我的应用程序。 我认为只要添加在一定时间内可见,您就可以获得展示的功劳。只要您的应用程序不经常轮换,它就不是问题。 很高兴得到一些确认。

      【讨论】:

        【解决方案3】:

        我可以确认这个现象,我在任何一个方向的初始页面加载时都没有收到错误,但我确实在旋转时遇到了错误。

        我确实尝试了隐藏技巧来消除“错误”,但无济于事。正如马克所说,我想我应该把它去掉,除非你付出很多努力,否则它看起来很丑。

        我对此进行了一些阅读,并从 Apple 的文献中了解到,如果部分广告被遮挡,似乎不会加载新广告,这表明我们获得了每个加载的广告的功劳,而不是总广告显示时间。

        【讨论】:

          猜你喜欢
          • 2011-11-12
          • 1970-01-01
          • 2011-05-08
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-11-08
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多