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.
Asked
Active
Viewed 1,790 times
0
-
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 Answers
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