即使在interstitialWillPresentScreen之后,Swift admob也没有显示

时间:2018-02-22 06:19:09

标签: swift admob

我不知道为什么,但即使在印刷了Admop interstitialWillPresentScreen之后, 广告没有显示。

func interstitialWillPresentScreen(_ ad: GADInterstitial) {
        print("Admop interstitialWillPresentScreen")
    }

的appDelegate

 GADMobileAds.configure(withApplicationID: "ca-app-pub-3940256099942544/4411468910")

的ViewController

override func viewDidLoad() {
    super.viewDidLoad()

interstitial = GADInterstitial(adUnitID: "ca-app-pub-   3940256099942544/4411468910")
    interstitial.delegate=self
    let request = GADRequest()
    interstitial.load(request)

 }

func didSelectRowAt(indexPath:IndexPath){
     <-- I want to show ad when this function is called back from    table view. 
    if interstitial.isReady {
        print("Ad showing")
        interstitial.present(fromRootViewController: self)
    } else {
        print("Ad wasn't ready")
    }

但我觉得问题是...... 我没有来自main.storyboard的视图...... 我从viewDidLayoutSubviews方法中的代码生成所有视图。

我猜......这就是原因...... ???

我在代码中找不到任何错误,因为它涉及interstitialWillPresentScreen方法......

0 个答案:

没有答案