【问题标题】:AdMob ads not coming in to view using UIWebView使用 UIWebView 无法查看 AdMob 广告
【发布时间】:2012-12-28 11:49:20
【问题描述】:

我在我的应用中使用以下代码(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 中使用它并没有任何反应。

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

【问题讨论】:

    标签: objective-c cocoa-touch uiwebview ios6 admob


    【解决方案1】:

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

    您是否将GADBannerView 作为子视图添加到您的UIWebView?因为那行不通。你最好降低UIWebView 的高度并将GADBannerView 添加到也包含UIWebView 的某种类型的容器视图中。

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

    【讨论】:

      猜你喜欢
      • 2019-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-09
      相关资源
      最近更新 更多