2017-03-06 60 views
0

我在我的應用程序集成間質廣告到幾塞格斯。防止在用戶解除廣告之前發生爭執?

問題是間質載荷,然後瞬間由SEGUE觸發無效。

有沒有一種方法,以便暫停不運行SEGUE的功能,直到廣告被關閉?這是我能想到解決這個問題的唯一方法。代碼如下:

@IBAction func closeExerciseDetails(_ sender: Any) { 
    if (self.interstitial.isReady) { 
     self.interstitial.present(fromRootViewController: self) 
     self.interstitial = self.createAd() 
    } 
    self.performSegue(withIdentifier: "unwindToExercisesSegue", sender: self) 
} 

編輯:原位缺口工作新的代碼...

@IBAction func closeExerciseDetails(_ sender: Any) { 
    if (self.interstitial.isReady) { 
     self.interstitial.present(fromRootViewController: self) 
     self.interstitial = self.createAd() 
    } 
} 

func interstitialDidDismissScreen(_ ad: GADInterstitial) { 
    self.performSegue(withIdentifier: "unwindToExercisesSegue", sender: self) 
} 

回答

3

有此委託:

- (void)interstitialDidDismissScreen:(GADInterstitial *)interstitial { 
} 

你可以只在此委託執行SEGUE 。

+0

什麼會變成這樣在迅速?我找不到它? – jwarris91

+0

func interstitialDidDismissScreen(_ ad:GADInterstitial){ } –

+0

編輯:不用擔心,我沒有設置子類 – jwarris91

相關問題