如何修复GADBannerView的属性,以便加载请求

时间:2016-05-11 07:10:43

标签: swift admob

我收到此错误:

2016-05-11 17:07:43.496 Inspire[2265:1045224] <Google> 
  You must set the        rootViewController property of 
  <GADBannerView: 0x136586cb0; frame = (47 0; 320 50); 
  clipsToBounds = YES; autoresize = RM+BM; layer = 
  <CALayer: 0x1365876b0>> before loading a request.

我的GADBannerView根本没有出现。

如何解决此问题以使其加载?

感谢。

1 个答案:

答案 0 :(得分:2)

想出来。把这个

 print("Google Mobile Ads SDK version: \(GADRequest.sdkVersion())")
    bannerView.adUnitID = "ca-app-pub-3940256099942544/2934735716"
    self.bannerView.rootViewController = self;
    let request: GADRequest = GADRequest()
    self.bannerView.loadRequest(request)

在你的admob adbanner的代码中

replaceAll()