Google AdMob未展示广告

时间:2011-09-18 11:17:03

标签: iphone objective-c ios admob

我正在尝试添加Google广告,但我没有收到添加内容,

// 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];

我做错了什么?

2 个答案:

答案 0 :(得分:1)

实施GADBannerViewDelegate协议方法,以便从广告请求中获取回调并调试您是否收到广告,或者您的代码无法显示广告。请参阅GADBannerViewDelegate documentation

答案 1 :(得分:0)

检查两次您输入“您的出版商ID”:) 另外,请检查应用的adMob个人资料中的设置。