pod 'Google-Mobile-Ads-SDK'
FirebaseAnalytics/AdIdSupport (8.9.1)
Firebase (8.9.1):
Xcode -Version 12.4 (12D4e)
iPad Simulator -12.9 inch 3rd Generation
目前在這個問題上撲執行緒
代碼:
// called in ViewDidLoad
func initializeAdMob() {
let adMobKey = "ca-app-pub-3940256099942544/2934735716"
bannerView.adUnitID = adMobKey
bannerView.rootViewController = self
bannerView.delegate = self
let adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(frame.size.width)
bannerView.adSize = adSize
view.addSubview(bannerView)
bannerView.heightAnchor.constraint(equalToConstant: 50).isActive = true
bannerView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
bannerView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
bannerView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -15).isActive = true
bannerView.load(GADRequest())
}
uj5u.com熱心網友回復:
它似乎只發生在測驗環境中。
我發布的應用程式沒有任何問題。
如果您在release模式下運行它并使用實際id它應該可以作業。
奇怪的是,如果我讓它坐一會兒,虛擬配接器訊息會經常出現(就像它要求一個新廣告),如果你等待的時間足夠長,它實際上可能會顯示一個廣告,然后你開始得到再次虛擬訊息。
我認為這是 Admob 服務器的事情,每隔一段時間你就會收到一個虛擬廣告。
此外,嘗試使用print上adSize的bannerViewWillPresentScreen委托,我漸漸height = 0的也有。當我fluid用作尺寸時。所以橫幅在那里,但你看不到它,因為高度為零。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/387243.html
