简体   繁体   中英

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.

But you can try setting testDevices in your GADRequest . The device Id will be being printed out in your console by the AdMob SDK.

Then add the below code.

r.testDevices = @["test_device_id"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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