Tomasz Wójcik Tomasz Wójcik - 2 years ago 148
Swift Question

AdMob Interstitial: No ad to load (works on one project but not on another)

I've run into a very strange issue with AdMob. On my main project I receive error that there is no ad to load (when trying to fetch


However when I created a new project, copied the AdMob related sources, launched the project it loaded the ad without any problem (it looks like it always loads the test ad; I gave it few tries just to be sure).

On both projects I'm using the same Google pods:

pod 'Google-Mobile-Ads-SDK'
pod 'Google/Analytics'

I've been trying various solutions, generating different ad unit id's, tested the new project without analytics, then attached analytics to it. It worked like a charm during every step.

On my main project I got the ad once, strangely it was for ad unit id (banner view). Sadly since then I cannot get neither banner or interstitial ad (I couldn't retrieve the interstitial ad before).

My target platform is iOS 8+.

Sources, the

import GoogleMobileAds

class AdMobManager {
static let sharedInstance = AdMobManager()

private(set) var interstitial: GADInterstitial!

func loadInterstitialAd(delegate: GADInterstitialDelegate) -> GADInterstitial {
interstitial = GADInterstitial(adUnitID: "same-ad-unit-id-for-both-projects")
interstitial.delegate = delegate

let request = GADRequest()
request.testDevices = [ "same-test-id-for-both-projects" ]

return interstitial

And the

import UIKit
import GoogleMobileAds

class ViewController: UIViewController {
private var interstitial: GADInterstitial!

override func viewDidLoad() {
interstitial = AdMobManager.sharedInstance.loadInterstitialAd(self)

extension ViewController: GADInterstitialDelegate {
func interstitialDidReceiveAd(ad: GADInterstitial!) {
if interstitial.isReady {
} else {
NSLog("Not ready")

func interstitial(ad: GADInterstitial!, didFailToReceiveAdWithError error: GADRequestError!) {
NSLog("Error: \(error.debugDescription)")

Answer Source

Cause of my problem was custom User-Agent.

Hope that save somebody hours of debugging since AdMob documentation doesn't cover that.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download