3

It shows test Ads on the Simulator and on real device. But when I change the Ad ID to my real one, it is not working.. My App is also in the AppStore, but I did not push the update. I only added AdMob in Xcode and then connected my real device and tested on it. Have I to publish the new update with AdMob to the App Store to see the real ads? What should I do? I would like to test my real ads before pushing update..

(Payment details already filled)

final private class BannerVC: UIViewControllerRepresentable  {

    func makeUIViewController(context: Context) -> UIViewController {
        let view = GADBannerView(adSize: kGADAdSizeBanner)

        let viewController = UIViewController()
        view.adUnitID = bannerID
        view.rootViewController = viewController
        viewController.view.addSubview(view)
        viewController.view.frame = CGRect(origin: .zero, size: kGADAdSizeBanner.size)
        view.load(GADRequest())

        return viewController
    }

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

struct Banner:View{
    var body: some View{
        HStack{
            Spacer()
            BannerVC().frame(width: 320, height: 50, alignment: .center)
            Spacer()
        }
    }
}

2 Answers2

2

I think you do need to publish the app in order to see real ads showing up. After that it takes a while for them to show, but if you're seeing test ads, from what I remember reading, it should indicate it has been set up correctly.

After you publish, make sure you are able to select the App Store listing in the AdMob settings: AdMob > [App Name] > App Settings > App Store

If it's not showing up there, but your test ads are working fine, you might just need to wait. I had a similar situation recently and it took a full 2 (maybe 3?) weeks before real ads started showing.

Also, double-check your GADApplicationIdentifier is correct in the Info.plist file.

mintymuz
  • 262
  • 2
  • 14
  • SO you would say I test all with test IDs and when before pushing the update, change it to the real IDs and then hope that the real ads will show soon? – Maximilian Peter Jan 04 '21 at 17:41
  • But I want to publish the update, when I am sure that the real ads will be shown directly after the new update – Maximilian Peter Jan 04 '21 at 17:41
  • 1
    I believe that's the only way... I had exactly the same thought process as you about a month ago and I spent ages trying to work out why real ads weren't showing up in testing, even though test ads were showing - just as you have described. I eventually pushed it live with the live ID, then two weeks later, the ads started to show. – mintymuz Jan 04 '21 at 21:47
  • The real ads will come out when (I guess) google has a chance to index or re-index their database. It's not instant. Took mine bout 10+ days before it came out. – app4g Jan 12 '21 at 02:37
0

I had the same problem and thought I would never be able to fix it.

Reason of the error: Admob is showing test ads because the ad loaded from admob does not fit in the container, mostly a linear layout because the ad loaded is bigger in width.

Fix: How I fixed was to create a banner ad of custom size of 320x50 and then load it.

I'm unable to post my code in the answer, but you can figure out your own from Jay Patel's answer to the following stackoverflow question.

How to set adSize?

Wakeel Ahmad
  • 43
  • 10