谷歌的AdMob没有显示广告
问题描述:
我试图添加一个谷歌广告,我不recieving增加了,谷歌的AdMob没有显示广告
// Create a view of the standard size at the bottom of the screen.
bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView.adUnitID = @"XXXXXXXXXXXX";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView.rootViewController = self;
///////////////////////////
[self.view addSubview:bannerView];
// Initiate a generic request to load it with an ad.
GADRequest* gadReq = [[GADRequest alloc] init];
[gadReq setTesting:YES];
[bannerView loadRequest:gadReq];
我做了什么错?
答
检查两次,您输入“您的PUBLISHER ID”:) 此外,请检查您的应用的adMob配置文件中的设置。
答
实现GADBannerViewDelegate协议方法从广告请求中获取回调,并调试您是不是收到广告,或者您的代码是否无法显示。请参阅GADBannerViewDelegate documentation。
+0
您的建议解决了我的问题,谢谢! – rockXrock
在您的实际代码中,您将用实际值替换广告单元ID,对吗? – ThomasW
对,这就是我所做的,但我不知道它现在工作正常 – user784625
如果它工作,那么你应该关闭这个问题。 – ThomasW