2011-09-18 165 views
0

我試圖添加一個谷歌廣告,我不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]; 

我做了什麼錯?

+0

在您的實際代碼中,您將用實際值替換廣告單元ID,對嗎? – ThomasW

+0

對,這就是我所做的,但我不知道它現在工作正常 – user784625

+2

如果它工作,那麼你應該關閉這個問題。 – ThomasW

回答

0

檢查兩次,您輸入「您的PUBLISHER ID」:) 此外,請檢查您的應用的adMob配置文件中的設置。

1

實現GADBannerViewDelegate協議方法從廣告請求中獲取回調,並調試您是不是收到廣告,或者您的代碼是否無法顯示。請參閱GADBannerViewDelegate documentation

+0

您的建議解決了我的問題,謝謝! – rockXrock