I'm building my iOS application, and I've added a couple of advertisement to it. But I just found out a problem.
When the AdMob interstitial is running, It won't perform the segue after the advertisement is done.
if self.interstitial.isReady
{
self.interstitial.present(fromRootViewController: self)
self.performSegue(withIdentifier: "History", sender: self)
}
So, once I press the "X" to close the advertisement, it won't perform the segue. it just remains on the same page as before.
How can I fix this? Thanks!
edit
So, when I click on a "SAVE" button, this code will be running.
if self.interstitial.isReady
{
self.interstitial.present(fromRootViewController: self)
self.interstitialDidDismissScreen(self.interstitial) //Calling the dismiss function here
}
<
//Advertisement will dismiss from the screen
func interstitialDidDismissScreen(_ ad: GADInterstitial)
{
self.performSegue(withIdentifier: "History", sender: self)
}
Somehow it still won't perform the segue.
The best way to do this would be to perform the segue when the user presses the x. to do this use this function:
func interstitialDidDismissScreen(_ ad: GADInterstitial) {
//Perform your segue
}