Home > Back-end >  'Cannot find type 'GADInterstitialAd' in scope' error
'Cannot find type 'GADInterstitialAd' in scope' error

Time:10-21

Hello I am getting this error when archiving my app on XCode. The app runs correctly on Simulator and on a Physical Device, but when I try to archive I get this error:

Cannot find type 'GADInterstitialAd' in scope

This is pod file:

pod 'Google-Mobile-Ads-SDK','~>8.0'

I import Google ads as well like so:

import GoogleMobileAds

This is interstitial implementation:

GADInterstitialAd.load(withAdUnitID: NSLocalizedString("interstitial_id", comment: ""), request: request, completionHandler: {[weak self] (ad, error) in
        if error != nil {
            return
        }
        self!.interstitial = ad
        self!.interstitial.fullScreenContentDelegate = self
    })

CodePudding user response:

You are propably using legacy API for intersticial Ad. Google sometimes changes the API without properly telling everyone..

Try implementing new Intersticial Ad API where you use GAMInterstitialAd.load instead of GADInterstitialAd.load .

Here is documentation for new api : Google Intersticial API link

CodePudding user response:

I fixed this issue by moving Pods to trash manually because pod deintegrate didn't work and I reinstalled pods all from scratch. Then I added the Google Ads SDK frameworks to Link Binary With Libraries manually.

  • Related