AdMob - display real ads in debug mode

801 views
Skip to first unread message

vero...@blackbear.bg

unread,
Apr 25, 2018, 7:13:10 AM4/25/18
to Google Mobile Ads SDK Developers
I'd like to display AdMob interstitials in my app. I manage to display test ads. As far as I understand to display test ads you should add test devices, so this is what I do. When I remove the test devices though, I don't get the real ads. I'd like to test somehow that real ads will be displayed. When I remove the test devices I get interstitial(_ ad: GADInterstitial, didFailToReceiveAdWithError error: GADRequestError) delegate method called and the error is: Request Error: No ad to show. This is my code based on the instructions here

class MoviesViewController: UIViewController {
    
    var interstitial: GADInterstitial!

    override func viewDidLoad() {
        super.viewDidLoad()

        interstitial = createAndLoadInterstitial()
    }

    func createAndLoadInterstitial() -> GADInterstitial {
        let interstitial = GADInterstitial(adUnitID: "<Ad-Unit-ID>")
        interstitial.delegate = self
        let request = GADRequest()
        //request.testDevices = ["<Device-Test-ID>"]
        interstitial.load(request)
        return interstitial
     }

    @IBAction func didTapStartOver(_ sender: Any) {
        if interstitial.isReady {
            interstitial.present(fromRootViewController: self)
        } else {
            print("Ad wasn't ready")
            interstitial = createAndLoadInterstitial()
        }
    }


GADInterstitialDelegate:

    extension MoviesViewController : GADInterstitialDelegate {
    
    /// Tells the delegate an ad request succeeded.
    func interstitialDidReceiveAd(_ ad: GADInterstitial) {
        print("interstitialDidReceiveAd")
    }
    
    /// Tells the delegate an ad request failed.
    func interstitial(_ ad: GADInterstitial, didFailToReceiveAdWithError error: GADRequestError) {
        print("interstitial:didFailToReceiveAdWithError: \(error.localizedDescription)")
    }
    
    /// Tells the delegate that an interstitial will be presented.
    func interstitialWillPresentScreen(_ ad: GADInterstitial) {
        print("interstitialWillPresentScreen")
    }
    
    /// Tells the delegate the interstitial is to be animated off the screen.
    func interstitialWillDismissScreen(_ ad: GADInterstitial) {
        dismiss(animated: false, completion: nil)
        print("interstitialWillDismissScreen")
    }
    
    func interstitialDidDismissScreen(_ ad: GADInterstitial) {
        print("interstitialDidDismissScreen")
        interstitial = createAndLoadInterstitial()
    }
    
    /// Tells the delegate that a user click will open another app
    /// (such as the App Store), backgrounding the current app.
    func interstitialWillLeaveApplication(_ ad: GADInterstitial) {
        print("interstitialWillLeaveApplication")
    }
        
    }
 

I added a mediation group and was able to receive one real ad. After that the issue persists (no more ads to show).


mobileadssdk-a...@google.com

unread,
Apr 25, 2018, 3:04:38 PM4/25/18
to vero...@blackbear.bg, Google Mobile Ads SDK Developers
Hi Veronika,

If you are able to load test ads, then there is no issue with your integration and it must be with your Ad Unit ID. Can you share your Ad unit Id with us to debug on our end? Or see if using our sample apps work with your Ad Unit ID?

You can share the requested information using "Reply privately to Author" option.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/c9fa356c-2278-4abc-b160-36038e369a5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mobileadssdk-a...@google.com

unread,
Apr 26, 2018, 2:59:42 PM4/26/18
to vero...@blackbear.bg, Google Mobile Ads SDK Developers
Hi Veronika,

It might be a device specific issue. I've tested the Ad unit Id using our sample apps with an iPad Mini and the other iOS test devices available with me and I was able to load ads without any issues. Can you check on the other devices and see if the issue still exists? If you are still seeing the issue, please send us the complete device logs for us to debug on our end.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsubscrib...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages