6

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.

  • Thanks for the comment Matt, these don't seem to help unfortunately. As far as I can see in my code, I have set the root view controller to present full screen, however when the ad pops up which refers to the root view controller, it still presents modally. I'm sure it's something I've set up wrong as I'm still a novice, but for the life of me I can not find where the issue is :( – Chris Hefferman Jul 20 '19 at 21:54
  • It must be my poor explanation - apologies. I have a main view controller, which via story board I have set to present full screen, which works successfully. However, I also have an advert that pops up using GoogleAdMob which presents another view every so often when a user clicks a button. This view is called using 'interstitial.present(fromRootViewController: self)'. In iOS 12 this would always present full screen, the same as the rootViewController. However, in iOS 13 this is presenting modally, even though I have amended the root view to present full screen. Does that make more sense? – Chris Hefferman Jul 20 '19 at 23:13
  • Well it sounds to me like GoogleAdMob needs to update their code. – matt Jul 20 '19 at 23:30
  • That’s what I’m thinking as well, but part of me just doubts my code as well. Thank you for your time replying to me Matt, hugely appreciate it as I know it can be frustrating with newer devs such as myself! Thank you – Chris Hefferman Jul 21 '19 at 06:13
  • So looks like Google already updated their framework, I just needed to pull the update. So a simple ‘pod update’ in Terminal solved the problem. Thanks for your help Matt – Chris Hefferman Jul 23 '19 at 16:47
  • Excellent! Thanks for reporting back. – matt Jul 23 '19 at 16:51

1 Answers1

5

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.