0

I get this error in one of my ViewController sometimes but it doesn't happen always so I can't trace the reason behind the error. Can anyone fill me in on what I should look for.

  • Does this answer your question? ["Application tried to present modally an active controller"?](https://stackoverflow.com/questions/7429014/application-tried-to-present-modally-an-active-controller) – Phil Dukhov Aug 20 '21 at 16:45

1 Answers1

0

try to wrap the ViewController presentation with this check:

if vc.presentingViewController?.isBeingPresented ?? false 
{
        self.present(vc, animated: true)
}else{
       print("you probably crashed here!")
}
Aviram Netanel
  • 12,633
  • 9
  • 45
  • 69