Admob广告未显示iOS [英] Admob Ads not displaying iOS

查看:507
本文介绍了Admob广告未显示iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个横幅广告和一个插页广告。当我使用AdMob为您提供的adUnitID进行测试时,它们会出现,但是当我使用实时广告时,它们都没有显示。横幅根本没有出现。当插页式广告出现时,它只是全黑。 adUnitID是正确的。我的其他应用程序上的广告目前显示正常。当我使用iOS模拟器和设备时,都会出现此问题。有什么想法吗?

I have a banner ad and an interstitial ad. They are appearing when I use the adUnitID's for testing purposes that AdMob gives you, but neither of them are showing when I use live ads. The banner just doesn't appear at all. When the interstitial ad appears, it is just completely black. The adUnitID's are correct. The ads on my other apps are currently appearing just fine. The problem occurs both when I use the iOS simulator and my device. Any ideas?

var interstitial: GADInterstitial!

func createAndLoadAd() -> GADInterstitial{
    let ad = GADInterstitial(adUnitID: "ca-app-pub-7863284438864645/1835730011")
    let request = GADRequest()
    ad.loadRequest(request)
    return ad

}


override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    authenticateLocalPlayer()
    self.bannerView.adUnitID = "ca-app-pub-7863284438864645/9358996816"
    self.bannerView.rootViewController  = self
    let request: GADRequest = GADRequest()
    self.bannerView.loadRequest(request)
    self.interstitial = self.createAndLoadAd()

}

override func viewDidAppear(animated: Bool) {
    _ = GADRequest()
    //request.testDevices = ["2077ef9a63d2b398840261c8221a0c9b"]
    showAd()

}
func showAd(){

    if(self.interstitial.isReady){
        print("ad ready")
        self.interstitial.presentFromRootViewController(self)

    }
    else{
        print("ad not ready")
        self.interstitial = createAndLoadAd()
    }


}


推荐答案

这是一个问题,因为我的问题看起来很相似,但事实并非如此。

This is an aside, because my problem looked similar, but was not.

应用程序ID 否T 广告单元ID 相同。

而且,愚蠢的是,它们都以 ca-app-pub开头-和很多数字。我使用的应用ID不能100%保证正常工作。

And, stupidly, they BOTH start with ca-app-pub- and a lot of numbers. I was using the App ID which I can guarantee 100% does NOT work.

是的,我觉得很傻,但是Google的员工应该使它们不一样。

Yes, I feel pretty silly, but the folks at Google should have made them dissimilar.

这篇关于Admob广告未显示iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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