【问题标题】:New iAd crashes in iOS 6iOS 6 中的新 iAd 崩溃
【发布时间】:2013-10-23 19:40:24
【问题描述】:

Apple 在 iOS 7 中引入了新的 iAd 功能:

self.canDisplayBannerAds = YES;

在 iOS 7 中,这很有效。但如果我在 iOS 6 设备上运行我的应用程序, 应用程序崩溃。

以这种方式工作:

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
   {
    self.canDisplayBannerAds = YES;
   }

我的问题:这是正常的方式,还是有更好的解决方案?

【问题讨论】:

    标签: ios ios6 ios7 iad banner


    【解决方案1】:

    更好的办法是检查方法是否可用:

    if ([self respondsToSelector:@selector(setCanDisplayBannerAds:)]) {
        self.canDisplayBannerAds = YES;
    }
    

    【讨论】:

    • 谢谢!这是如何工作的:[UIViewController prepareInterstitialAds];
    • 检查this answer 为类方法执行此操作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多