启动应用程序后,如何从测试广告过渡到真实广告?

问题描述 投票:-1回答:1

我正在使用测试广告并通过测试设备加载它。我即将把我的应用程序放在应用商店上,这样测试设备就不存在了。我知道我需要将我的广告密钥更改为真实密钥,但是我应该如何更改代码以便在用户设备而不是测试设备上加载?

func createInterstitialAd() -> GADInterstitial? {

    interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910")
    guard let interstitial = interstitial else {
        return nil
    }

    let request = GADRequest()
    request.testDevices = [kGADSimulatorID]
    interstitial.load(request)
    interstitial.delegate = self


    return interstitial

}
ios swift xcode storekit
1个回答
1
投票

在部署之前,您是否只能将生产应用程序ID编辑到您的功能中?正如Admob插页式文档中所述,“只需确保在发布应用之前将其替换为您自己的广告单元ID。”

https://developers.google.com/admob/ios/interstitial

func createAndLoadInterstitial() -> GADInterstitial {
  var interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910")
  interstitial.delegate = self
  interstitial.load(GADRequest())
  return interstitial
}
© www.soinside.com 2019 - 2024. All rights reserved.