2

I'm writing an iOS app in the latest version of Swift where, among other things, I need to dismiss a view controller when certain things happen. For that I have the code

self.dismiss(animated: true) {
   // Completion logic goes here
}

I've tried it on several iOS devices and various simulators. It works fine in iOS 13.x, but for iOS 12.1 the body of the completion handler is never reached. Why exactly is that? My target, if that matters, is iOS 12.4, but changing it hasn't helped.

AppLover
  • 149
  • 9
  • check this thread, It may help: https://stackoverflow.com/questions/45648338/function-is-not-fired-in-dismiss-completion-block – Amr El-Sayed Feb 02 '20 at 09:27
  • 2
    This is a very broad question, you may want to explain your situation little bit more(How you call it, when you call it etc.). In normal cases, that code has to work but some cases it may fail. Also, there might be differences between iOS12 and iOS 13 internals. – Güngör Basa Feb 02 '20 at 12:57
  • I call it inside the ```viewDidAppear``` of some View Controller. Basically, when the view appears, I check who's logged in (if anyone), load the user's data (if they are authenticated), and call ```self.dismiss``` to segue to a different view controller. I call the segue in the handler's body that doesn't seem to be reached when you deploy to a 12.1 device (in a simulator). When you deploy to 13.x, it works like a charm. I tested it on an iPhone 8 with both iOS version, so it's clearly a software issue. What exactly are you asking about the internals? – AppLover Feb 02 '20 at 22:45

0 Answers0