Thursday, August 11, 2022
HomeiOS Developmentios - Admob advertisements not displaying on iPad simulator

ios – Admob advertisements not displaying on iPad simulator


I’m utilizing adMob to show advertisements and every thing works fantastic after I simulate my app on an iphone. Nevertheless, after I swap the simulator to an iPad, the advertisements to not seem. I’ve made positive that the ID getting used is the take a look at ID, nonetheless, my app just isn’t effectively optimized for iPad so it might simply be that. Does anybody have any recommendation or recommendations on methods to repair this? Right here is my code for AdMob

struct GADBannerViewController: UIViewControllerRepresentable{
func makeUIViewController(context: Context) -> some UIViewController {
    
    let view = GADBannerView(adSize: GADAdSizeBanner)
    let viewController = UIViewController()
    let testID = "take a look at mode id string right here"
    
    let realID = "advert unit string right here"
    
    //Banner Advert
    view.adUnitID = testID
    view.rootViewController = viewController
    
    //View Controller
    viewController.view.addSubview(view)
    viewController.view.body = CGRect(origin: .zero, measurement: GADAdSizeBanner.measurement)
    
    //Load an advert
    view.load(GADRequest())
    
    return viewController
}

func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {
    
}
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments