Warning: Attempt to present * on * which is already presenting (null) Warning: Attempt to present * on * which is already presenting (null) ios ios

Warning: Attempt to present * on * which is already presenting (null)


I have found out a solution.

I have add the following code in HomeViewController.viewDidLoad and that works !

definesPresentationContext = true


In my case, I found my code to present the new viewController (a UIAlertController) was being called twice.

Check this before messing about with definesPresentationContext.


In my case, I tried too early to show the new UIViewController before closing the previous one. The problem was solved through a call with a slight delay:

DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {     self.callMethod()}