如何显示admobs插播式广告不止一次? [英] How to show admobs interstitial ads more than once?

查看:368
本文介绍了如何显示admobs插播式广告不止一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道如何表达间质性admobs不止一次?我迅速写的,但我的目标C以下。

Anyone know how to show interstitial admobs more than once? I wrote it in swift, but I have objective C below.

我有一个FUNC至preLOAD广告

I have a func to preload the ad

func preLoadInterstitial () {

    intertitialRequest.testDevices = [GAD_SIMULATOR_ID]
    self.interstitial.adUnitID = "ca-app-pub-3940256099942544/2934735716"
    interstitial.delegate = self
    interstitial.loadRequest(intertitialRequest)  
}

然后一个函数来调用广告

Then a function to call the ad

 func showInterstitial() {
    println("interstitial")
    interstitial.presentFromRootViewController(self)
}

最后一个函数来尝试重新申请一个页内广告关闭广告后。

Lastly a function to try to re-request an interstitial ad after you close the ad.

func interstitialDidDismissScreen(ad: GADInterstitial!) {

    self.preLoadInterstitial()
}

然而,当我合上的广告,我得到的错误请求错误:因为间质性对象已使用不会发送请求。然后,该程序将不会加载任何更多的间隙。那么,你如何要求/显示另一页内广告?

However, after I close the ad, I get the error "Request Error: Will not send request because interstitial object has been used." Then the program won't load any more interstitials. So how do you request/show another interstitial ad?

我觉得我的code目标C相当于是这样

I think the equivalent of my code in objective C would look like this

(void)showInterstital {

    self.interstitial presentFromRootViewController:self;
}

(void)preLoadInterstitial {
    self.interstitial = [[GADInterstitial alloc] init];
    self.interstitial.adUnitID = @"ca-app-pub-3940256099942544/2934735716";
    GADRequest *request = [GADRequest request];
    request.testDevices = @[ GAD_SIMULATOR_ID ];
    [self.interstitial loadRequest:request]
}

(void)interstitialDidDismissScreen:(GADInterstitial *)interstitial {
    self.interstitial = [self preLoadInterstitial];
}

任何帮助迅速或客观-C将AP preciated!预先感谢您!

Any help in swift or objective-C would be appreciated! Thank you in advance!

推荐答案

您需要调用interstitial.loadRequest(intertitialRequest)(用新的请求对象)显示每个间隙之前。

You need to call interstitial.loadRequest(intertitialRequest) (with a new request object) prior to showing each interstitial.

这篇关于如何显示admobs插播式广告不止一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆