gpt4 book ai didi

ios - GoogleMobileAds sdk 的奇怪行为

转载 作者:行者123 更新时间:2023-11-30 12:33:10 24 4
gpt4 key购买 nike

当我将此方法放入 application(_ application: UIApplication,
didFinishLaunchingWithOptions

GADMobileAds.configure(withApplicationID:“MYAPPID”)

我的广告按预期显示。

但是,一旦我将 GADMobileAds.configure(withApplicationID: "MYAPPID") 移动到位于库框架内的辅助方法,并调用该辅助方法,广告就不会显示向上。据我所知,控制台中没有任何日志表明出了什么问题。

有谁知道为什么会这样吗?

最佳答案

swift 3.0

中使用此委托(delegate)
class ViewController: UIViewController , GADBannerViewDelegate{

// put this line in viewdidload()
let bannerview1 : GADBannerView = GADBannerView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 50))
bannerview1.adUnitID = "ca-app-pub-3940256099942544/2934735716"
bannerview1.rootViewController = self
bannerview1.delegate = self
bannerview1.load(GADRequest())
self.view.addSubview(bannerview1)

// Delegates for adv error

func adView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: GADRequestError) {
print(error)
}

}

关于ios - GoogleMobileAds sdk 的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43198744/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com