Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
405 views
in Technique[技术] by (71.8m points)

AdMob shows test Ads but not real Ads Swift / SwiftUI

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()
        }
    }
}
question from:https://stackoverflow.com/questions/65560155/admob-shows-test-ads-but-not-real-ads-swift-swiftui

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...