Google AdMob iOS - 没有可展示的广告

Google AdMob iOS - No Ads to Show

这个问题困扰我很久了。

  1. 测试广告出现在模拟器和实际中Phone。
  2. 实施是正确和最新的。
  3. AdMob 帐户已获批准,已添加付款信息。
  4. 应用程序也已上线。

还在说不No Ads to Show。请帮我解决这个问题。

这里是代码函数

func addBannerViewToView(_ bannerView: GADBannerView) {
    bannerView.translatesAutoresizingMaskIntoConstraints = false
    view.addSubview(bannerView)
    view.addConstraints(
        [NSLayoutConstraint(item: bannerView,
                            attribute: .bottom,
                            relatedBy: .equal,
                            toItem: bottomLayoutGuide,
                            attribute: .top,
                            multiplier: 1,
                            constant: 0),
         NSLayoutConstraint(item: bannerView,
                            attribute: .centerX,
                            relatedBy: .equal,
                            toItem: view,
                            attribute: .centerX,
                            multiplier: 1,
                            constant: 0)
    ])
}

我也试过这个而不是 adSize

 let request = GADRequest()
    //request.testDevices = ["e217e5a45bc6b1042b5ea044243894c0" ]

// GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [(kGADSimulatorID as!String)]

// 让 bannerSize = UIDevice.current.isPad ? kGADAdSizeFullBanner : kGADAdSizeBanner

let adSize = GADAdSizeFromCGSize(CGSize(width: UIScreen.main.bounds.width,
                                            height: UIDevice.current.isPad ? 90 : 50))
    
    banner = GADBannerView(adSize: adSize)
    addBannerViewToView(banner)
    banner.adUnitID = AD_MOB_BANNER
    banner.rootViewController = self
    banner.delegate = self
    banner.load(request)

似乎是 Google 广告问题。我的代码是正确的,广告开始出现。花了一些时间,但广告开始出现。

希望这对您有所帮助。如果您遇到类似问题,可以联系我