【问题标题】:How do I show multiple Admob interstitials?如何显示多个 Admob 插页式广告?
【发布时间】:2013-03-15 17:01:41
【问题描述】:

我有两部分代码

预加载

interestial = [[GADInterstitial alloc] init];
[interestial loadRequest:request]

显示

[interestial presentFromRootViewController:]

下次我应该怎么做才能正确显示插页式广告? 有和没有 ARC

预加载

if(arc) [interstitial release];
interstitial = [[GADInterstitial alloc] init];
[interstitial loadRequest:request]

显示

[interstitial presentFromRootViewController:self]

-- 或

初始化

interstitial = [[GADInterstitial alloc] init];

预加载

[interstitial loadRequest:request]

显示

[interstitial presentFromRootViewController:self]

-- 或

初始化

interstitial = [[GADInterstitial alloc] init];
[interstitial loadRequest:request];

预加载

// nothing

显示

[interstitial presentFromRootViewController:self];
[interstitial loadRequest:request];

如果最后一个选项不正确,那么在调用 present 后我应该等待多长时间进行预加载?或者我应该听委托还是等待一些用户操作开始预加载?

【问题讨论】:

    标签: admob interstitial


    【解决方案1】:

    您应该从GADInterstitialDelegate 监听interstitialDidDismissScreen: 方法。当您完成第一个插页式广告时,它会告诉您,您可以开始为下一个插页式广告做准备。

    所以你会有类似的东西:

    // During init time.
    self.interstitial = [[GADInterstitial alloc] init];
    self.interstitial.adUnitID = MY_INTERSTITIAL_UNIT_ID;
    self.interstitial.delegate = self;
    [self.interstitial loadRequest:[GADRequest request]];
    
    ...
    
    
    // During show time.
    [self.interstitial presentFromRootViewController:self];
    
    ...
    
    // When user dismisses the interstitial.
    - (void)interstitialWillDismissScreen:(GADInterstitial *)interstitial {
      self.interstitial.delegate = nil;
      if (!arc) {
        [self.interstitial release];
      }
    
      // Prepare next interstitial.
      self.interstitial = [[GADInterstitial alloc] init];
      self.interstitial.adUnitID = MY_INTERSTITIAL_UNIT_ID;
      self.interstitial.delegate = self;
      [self.interstitial loadRequest:[GADRequest request]];
    }
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多