我面对这个问题已经很长时间了。
在模拟器和实际Phone.
仍然拒绝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!(串)
//让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)发布于 2022-02-06 06:04:14
似乎这是谷歌的广告问题。我的代码是正确的,广告开始出现。这需要时间,但广告开始出现。
希望这能有所帮助。如果你面临类似的问题,你可以联系我。
https://stackoverflow.com/questions/64802866
复制相似问题