【发布时间】:2011-08-23 11:31:11
【问题描述】:
我正在尝试在应用上使用 AdMob(专为 iOS 4.0 构建)
我添加了教程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];
我收到“成功!您现在准备好穿越 App Galaxy”的默认横幅,但只有这个。
所以我的问题是:
- 示例代码还不足以展示广告吗?为什么我从来没有看到带有示例代码的广告?
- 据我了解,请求是指我的应用要求展示广告的次数。我也明白,并不是每个请求都得到了广告回复(否则填充率将是 100%),但我仍然没有看到广告,我做错了什么?
提前致谢。
【问题讨论】: