我試圖將AdMob添加到我的應用程序。iPhone - AdMob沒有出現。使用示例代碼
我跟着從例如從這裏的說明:與我創建了一個方法,我從viewDidLoad中
問題調用它的細微差別http://code.google.com/mobile/ads/docs/ios/fundamentals.html
是毫無顯現,不甚至是一個空框架。我也嘗試刪除除界面生成器的主視圖以外的所有內容,以確保它不在後面,但沒有任何內容出現。
我能做什麼錯?
這裏是我的方法的代碼:
- (void)showBanner {
// 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 = @"heresthestringofmyadmobid";
// 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_];
// Initiate a generic request to load it with an ad.
GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:
GAD_SIMULATOR_ID, // Simulator
@"heresthestringofmyphone", // Test iPhone 3Gs 4.3.1
nil];
[bannerView_ loadRequest:request];
}
我也試過harcoding的CGFrame 0,0,320,50,使其出現在頂部,但什麼都沒有發生任何
我試過也沒有運氣。我也嘗試過使用testdevices數組。 也許可以是admob頁面中的設置?我剛剛下載了示例代碼項目並運行它。沒有運氣要麼=( – Chompas 2011-05-09 02:49:23
爲我工作.......感謝兄弟... :) – 2013-06-18 04:46:56