我試圖使用AdMob上的應用內廣告(內置於iOS 4.0)AdMob廣告沒有出現在iPhone模擬器
我增加可用的樣本代碼在本教程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銀河去旅行」默認標題,但只有這一個。
所以我的問題是:
- 不是示例代碼足以顯示廣告?爲什麼我從來沒有看到帶有示例代碼的廣告?
- 據我瞭解,請求意味着我的應用程序要求顯示廣告的次數。我也明白,並不是每個請求都會回覆一個廣告(否則填充率將是100%),但仍然是,我從未看過廣告,我做錯了什麼?
在此先感謝。
我遇到了類似的困難,而且該設備並不好。另一個建議? – 2011-08-24 11:35:49
檢查您是否註冊了有效的adUnitID。如果你已經把它放在: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 2011-08-30 19:04:33
最終,當你運行一個新的單元ID時,它會產生滯後效應。幾天後,我再次使用了它,因爲沒有人使用該應用程序,但現在它已啓動,廣告顯示出來。 – 2011-08-31 10:04:41