Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having problems with an interstitial ad displaying modally in iOS13

Since running the iOS 13 beta I am having issues with my app displaying the interstitial view controller being displayed modally, therefore allowing the user to swipe down to dismiss the ad before the timer counts down.

I understand that modal views are now the default for iOS 13 and I have amended my main view controller to display full screen, however when the ad displays, this is still displayed modally and not full screen.

I have so far tried declaring the view controller, and then requesting it be displayed in full screen, then presenting the ad using the views declaration:

let vc = UIViewController()
vc.modalPresentationStyle = .fullScreen
interstitial.present(fromRootViewController: vc)

if interstitial.isReady {
   if #available(iOS 13, *) {
       interstitial.present(fromRootViewController: self)
       interstitialDidDismissScreen(interstitial)
   } else {
       interstitial.present(fromRootViewController: self)
       interstitialDidDismissScreen(interstitial)
   }

Expected result is that the view for the interstitial ad is displayed full screen so that a user cannot swipe down to dismiss the view before the time runs out.

This works fine in iOS 12.

like image 207
Chris Hefferman Avatar asked Jul 18 '19 22:07

Chris Hefferman


1 Answers

In case anyone else comes across this post, it was a simple solution in my case.

It appears as though Google had updated their framework but I wasn’t using the latest version of it.

Therefore a simple ‘pod update’ in Terminal updated the dependencies which in turn solved the problem.

I am using CocoaPods to manage my frameworks, but I’m sure for those who aren’t can find the best way to update their own dependencies.

like image 176
Chris Hefferman Avatar answered Sep 19 '22 13:09

Chris Hefferman