I’ve an app with a dashboard view, which when a person clicks on and merchandise within the dashboard its suppose to navigate to the detailed view and the complete display as wants to indicate.
Now right here is the place the difficulty is, after the advert is proven the detailed view (youngster view) is viewable for a fast second after which the navigation goes again to the dashboard view (father or mother view).
Right here is the code for my Admob:
class InterstitialAdsManager: NSObject, GADFullScreenContentDelegate, ObservableObject {
@Printed var interstitialAdLoaded: Bool = false
var interstitialAd: GADInterstitialAd?
let AD_UNIT_ID = "ca-app-pub-3940256032142544/xxxxxxxxx"
override init() {
tremendous.init()
}
func loadInterstitialAd() {
GADInterstitialAd.load(withAdUnitID: AD_UNIT_ID, request: GADRequest()) { [weak self] advert, error in
guard let self = self else { return }
if let error = error {
print("🔴: (error.localizedDescription)")
self.interstitialAdLoaded = false
return
}
print("🟢: Loading succeeded")
self.interstitialAdLoaded = true
self.interstitialAd = advert
self.interstitialAd?.fullScreenContentDelegate = self
}
}
func displayInterstitialAd(viewController: UIViewController) {
let root = UIApplication.shared.home windows.final?.rootViewController
if let advert = interstitialAd {
advert.current(fromRootViewController: root)
self.interstitialAdLoaded = false
} else {
print("🔵: Advert wasn't prepared")
self.interstitialAdLoaded = false
self.loadInterstitialAd()
}
}
func advert(_ advert: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
print("🟡: Did not show interstitial advert")
self.loadInterstitialAd()
}
func adWillPresentFullScreenContent(_ advert: GADFullScreenPresentingAd) {
print("🤩: Displayed an interstitial advert")
self.interstitialAdLoaded = false
}
func adDidDismissFullScreenContent(_ advert: GADFullScreenPresentingAd) {
print("😔: Interstitial advert closed")
}
}
The code for the Dashboard going to the detailed view is fairly commonplace.
Does anybody know the way i can resolve this and have the detailed view (youngster view) stay viewable and never return all the best way again to the dashboard (father or mother view)!?