当我在模拟器中测试Admob时,它抛出以下错误



我的密码

bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView_.adUnitID = @"8de66ecc3525495d";

bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];

GADRequest *request = [[GADRequest alloc] init];
request.testing = YES;
[bannerView_ loadRequest:request];

指导我将其存档。提前致谢..

最佳答案

您必须添加测试设备。使用Swift,只需替换

bannerView.load(GADRequest())


let request: GADRequest = GADRequest()
request.testDevices = [kGADSimulatorID]
bannerView.load(request)

如果您有iPhone,请同时运行该应用程序,它会告诉您ID。

要在此设备上获取测试广告,请致电:request.testDevices = @[@"HERE IS THE ID"];
已添加ID:
let request: GADRequest = GADRequest()
request.testDevices = ["PUT HERE THE ID", kGADSimulatorID]
bannerView.load(request)

10-08 20:03