swiftadmob

adDidDismissFullScreenContent - How do you determine if the ad was an Interstitial or Rewarded?


I'm using Google AdMob v8 to implement Interstitial ads and Rewarded Ads in the same View Controller.

I need to be able to determine which ad was dismissed, so that I can properly load up another.

func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) 
    
    loadRewarded()
    loadInterstitial()
}

My progress above is loading both a rewarded and interstitial no matter which ad was dismissed.

How can I determine which ad (either an Interstitial or Rewarded) was dismissed?


Solution

  • func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) 
        
        print("Ad dismiss full screen ad")
        if type(of: ad) == GADInterstitialAd.self {
          print("InterstitialAd")
        }else if  type(of: ad) == GADRewardedAd.self {
          print("RewardedAd")
        }
    }