简体   繁体   English

Admob在模拟器中显示广告,但不在设备中显示

[英]Admob showing ads in simulator but not in device

This is the code that I am currently using to show some ads on my device. 这是我目前用于在设备上展示一些广告的代码。 But it doesn't seem to work as of now. 但目前看来,它似乎还不起作用。 Need some guidance on what could be going wrong here. 需要一些有关这里可能出问题的指导。

self.adBanner = [[GADBannerView alloc]
                 initWithFrame:CGRectMake(0,468,320,50)];
self.adBanner.adUnitID = @"a153b29f919d822";
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
//self.adBanner.center = CGPointMake(self.view.center.x, self.adBanner.center.y);
GADRequest *r = [[GADRequest alloc] init];
r.testing = YES;
[self.adBanner loadRequest:r];

Thanks. 谢谢。

If you have recently setup up your account in Google AdMob, it is going to take sometime for the ads to start appearing on the device. 如果您最近在Google AdMob中设置了帐户,则广告可能需要一段时间才能开始在设备上展示。

But you can try setting testDevices in your GADRequest . 但是您可以尝试在GADRequest设置testDevices。 The device Id will be being printed out in your console by the AdMob SDK. AdMob SDK将在您的控制台中打印出设备ID。

Then add the below code. 然后添加以下代码。

r.testDevices = @["test_device_id"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM