首页 > 解决方案 > “在范围内找不到类型‘GADInterstitialAd’”错误

问题描述

您好,在 XCode 上归档我的应用程序时出现此错误。该应用程序在模拟器和物理设备上正常运行,但是当我尝试存档时出现此错误:

在范围内找不到类型“GADInterstitialAd”

这是 pod 文件:

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

我也像这样导入谷歌广告:

导入 GoogleMobileAds

这是插页式实现:

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
    })

标签: iosswiftxcodeadmobads

解决方案


您可能正在使用旧版 API 进行插页式广告。谷歌有时会在没有正确告诉所有人的情况下更改 API。

尝试在您使用GAMInterstitialAd.load而不是GADInterstitialAd.load.

这是新 api 的文档:Google Intersticial API 链接


推荐阅读