I encountered the same error and initially thought that was why ads weren’t showing in my app. However, I discovered that the real issue was that my app wasn’t yet available on the App Store, so my ads hadn’t been approved. You can test your ad setup by using a Google test ad unit ID, which should display ads in your app. The error message doesn’t go away, but it hasn’t affected the functionality for me either.
struct BannerAd: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
let viewController = UIViewController()
let bannerView = GADBannerView(adSize: GADAdSizeBanner)
bannerView.adUnitID = "ca-app-pub-3940256099942544/2934735716" // ID de prueba
bannerView.rootViewController = viewController
viewController.view.addSubview(bannerView)
bannerView.load(GADRequest())
bannerView.translatesAutoresizingMaskIntoConstraints = false
bannerView.centerXAnchor.constraint(equalTo: viewController.view.centerXAnchor).isActive = true
bannerView.bottomAnchor.constraint(equalTo: viewController.view.bottomAnchor).isActive = true
return viewController
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}