0

我在我的应用程序(viewDidLoad方法)中使用以下代码来显示 AdMob 广告:

// Create a view of the standard size at the bottom of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"ABC";

// 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.
[bannerView_ loadRequest:[GADRequest request]];

如果我在另一个应用程序或该应用程序的表视图(根视图控制器)中使用该代码,则广告显示正常。在我的使用它,UIWebView没有任何反应。

谁能建议问题可能是什么?

4

1 回答 1

0

当你说“在你身上使用它”时,你是什么意思UIWebView

您是否将GADBannerView作为子视图添加到您的UIWebView? 因为那行不通。你最好降低你的高度UIWebView并将.GADBannerViewUIWebView

基本上,在视图层次结构中创建UIWebView和兄弟姐妹。GADBannerView

于 2012-12-28T18:20:26.967 回答