我设置了一个非常简单的视图控制器,主要目的是尝试使用 Google Mobile Ads 7.20.0 运行测试原生广告。
使用下面发布的我的代码,Google 在其 Admob 存储库中提供的测试 adUnitID 不起作用。从来没有广告。但是,如果我使用生产 adUnitID,它显示得很好。我需要测试广告以用于开发目的。我没有使用 Firebase。
import GoogleMobileAds
import UIKit
class ViewController: UIViewController {
let testID = "ca-app-pub-3940256099942544/8897359316"
@IBOutlet weak var adView: GADNativeExpressAdView! // Using storyboard here.
override func viewDidLoad() {
super.viewDidLoad()
adView.adUnitID = testID
adView.rootViewController = self
let request = GADRequest()
request.testDevices = [kGADSimulatorID]
adView.load(request)
}
}
这是打印到控制台的内容
[DYMTLInitPlatform] platform initialization successful
[MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
[MC] Reading from public effective user settings.
<Google> To get test ads on this device, call: request.testDevices = @[ @"abc123" ];
Metal GPU Frame Capture Enabled
Metal API Validation Enabled
libMobileGestalt MobileGestaltSupport.m:153: pid 1983 (Native Admob Test) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
上面有什么东西看起来很明显吗?如何让 Google 测试广告 ID 与 Native Ad Express 一起使用?