我正在使用测试广告,并将其通过测试设备加载。我将把我的应用程序放到应用程序商店中,以使测试设备不存在。我知道我需要将广告密钥更改为真正的广告密钥,但是我应该如何更改代码,以便将其加载到用户设备而非测试设备上?
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
}
答案 0 :(得分: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
}