我正在尝试在一个适用于iOS 4.0的应用程序上使用AdMob。
我已经添加了教程http://code.google.com/mobile/ads/docs/ios/fundamentals.html中提供的示例代码(我已更改adUnitID):
我收到了“成功!您现在可以通过应用程序星系旅行”默认横幅,但只有这一个。
所以我的问题是:
我已经添加了教程http://code.google.com/mobile/ads/docs/ios/fundamentals.html中提供的示例代码(我已更改adUnitID):
// 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 = @"XYZ";
// 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_];
[self.view bringSubviewToFront:bannerView_];
GADRequest * request = [GADRequest request];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];
运行这段代码时,没有任何反应,广告也没有展示出来,但AdMob应用页面的请求次数会不规律地增加(即:我似乎无法注意到模式),但最重要的是没有广告展示。
如果我添加以下代码:
GADRequest * request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:
GAD_SIMULATOR_ID, // Simulator
nil];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];
我收到了“成功!您现在可以通过应用程序星系旅行”默认横幅,但只有这一个。
所以我的问题是:
- 示例代码不足以显示广告吗?为什么我从未看到过带有示例代码的广告?
- 据我所知,请求意味着我的应用程序请求展示广告的次数。我也明白,并非每个请求都会回复广告(否则填充率将达到100%),但仍然从未看到过广告,我做错了什么?
GADBannerView *bannerView = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0, self.view.frame.size.height - GAD_SIZE_320x50.height - 42, GAD_SIZE_320x50.width, GAD_SIZE_320x50.height)]; bannerView.adUnitID = MY_BANNER_AD_ID;
如果您还没有注册,请从这里开始:http://www.admob.com/register - rushafi