我想使用AdMob的一个应用程序(内置于iOS 4.0)
我已经添加了样品code教程http://$c$c.google.com/mobile/ads/docs/ios/fundamentals.html这是下面的(我已经改变了adUnitID):
//创建标准尺寸的屏幕底部的观点。
bannerView_ = [[GADBannerView页头]
initWithFrame:方法CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
//指定广告的单位标识符。这是你的AdMob发布者ID。
bannerView_.adUnitID = @XYZ;
//让运行时知道的UIViewController服用后恢复
//用户无论广告的推移,并把它添加到视图层次结构。
bannerView_.rootViewController =自我;
[self.view addSubview:bannerView_]。
[self.view bringSubviewToFront:bannerView_]。
GADRequest *请求= [GADRequest请求]
//初始化一个通用的请求与广告加载它。
[bannerView_ loadRequest:申请];
这样做没有任何反应,没有广告显示和不稳定在我的AdMob的应用页面上增加请求数(即:我似乎无法看到的模式),但最重要的是没有广告的展示
如果我添加以下code:
GADRequest *请求= [GADRequest请求]
request.testDevices = [NSArray的arrayWithObjects:
GAD_SIMULATOR_ID,//模拟器
零];
//初始化一个通用的请求与广告加载它。
[bannerView_ loadRequest:申请];
我得到的成功!您现在可以通过App银河去旅行默认标题,但仅此一家。
所以,我的问题是:
不是样品code,足以展示广告吗?为什么我从来没有看到与样品code广告? 据我的理解,是指请求被显示的次数我的应用程序要求的广告。我也明白,不是每一个请求答复与广告(否则填充率为100%),但仍,我从来没有看到一则广告,我究竟做错了什么?在此先感谢。
解决方案 GADBannerView * bannerView = [[GADBannerView页头]
initWithFrame:方法CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)]; //设置位置
bannerView.adUnitID = @12331255421245; //调用你的身份证
//让运行时知道的UIViewController服用后恢复
//用户无论广告的推移,并把它添加到视图层次结构。
bannerView.rootViewController =自我;
[self.view addSubview:bannerView]; //您尝试添加bannerview
//初始化一个通用的请求与广告加载它。
[bannerView loadRequest:[GADRequest要求];
I am trying to use AdMob on an app (built for iOS 4.0)
I've added the sample code available in the tutorial http://code.google.com/mobile/ads/docs/ios/fundamentals.html which is the following (I've changed the 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];
Doing this nothing happens, no ad is shown and the number of requests in my AdMob app page increase erratically (i.e.: I can't seem to notice a pattern), but the most important is no ad is shown.
If I add the following code:
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];
I get the "Success! You are now ready to travel through the App Galaxy" default banner, but only this one.
So my questions are:
Aren't the sample code enough to show ads? Why I never see an ad with the sample code? As far as I understood, requests mean the number of times my app asked for an ad to be shown. I also understood that not every request is replied with an ad (otherwise the fill rate would be 100%), but still, I NEVER saw an ad, what am I doing wrong?Thanks in advance.
解决方案 GADBannerView *bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];//Set Position
bannerView.adUnitID = @"12331255421245";//Call your id
// 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];//Your attempt to add bannerview
// Initiate a generic request to load it with an ad.
[bannerView loadRequest:[GADRequest request]];