我正在尝试添加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];
我做错了什么?
最佳答案
实施GADBannerViewDelegate协议方法以从广告请求中获取回调,并调试您是否未收到广告或代码无法显示它。请参见GADBannerViewDelegate documentation。