ios - 启动应用时如何从测试广告过渡到真实广告?
问题描述
我正在使用测试广告并通过测试设备加载它。我即将将我的应用程序放在应用程序商店中,以便不存在测试设备。我知道我需要将我的广告密钥更改为真实的,但我应该如何更改代码以使其加载到用户设备而不是测试设备上?
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
}
解决方案
您不能在部署之前将生产应用程序 ID 编辑到您的函数中吗?正如 Admob 插页式文档中所述,“只需确保在发布应用之前将其替换为您自己的广告单元 ID。”</p>
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
}
推荐阅读
- javascript - 茉莉花如何在javascript中覆盖对象文字的测试用例
- python - 在列表中查找短语索引的开头
- r - 黄土平滑 - geom_smooth vs() loess()
- c# - 如何防止在 C# 的 Foreach 循环中生成重复项
- arrays - 使用匹配和不匹配条件识别哈希中的项目
- ios - UISearchBar 一旦被点击就会跳出位置
- marklogic - 将 IRI 序列作为绑定变量中的值传递给 sem:sparql 函数 - marklogic
- spring-mvc - 非常简单的带有百里香叶的 Spring MVC 示例不起作用
- graph-theory - 强制边缘方向 GraphViz
- node.js - 在移动设备上使用 Google Cloud Speech 永远不会返回 isFinal