Warning: Attempt to present * on * which is already presenting (null)
Solution 1:
I have found out a solution.
I have add the following code in HomeViewController.viewDidLoad
and that works !
definesPresentationContext = true
Solution 2:
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
.
Solution 3:
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()
}
Solution 4:
The problem for me is that I was presenting two modals and I have to dismiss both and then execute some code in the parent window ... and then I have this error... I solved it seting this code in the dismiss o the last modal presented:
self.dismiss(animated: true, completion: {
self.delegate?.callingDelegate()
})
in other words instead of just dismiss two times .. in the completion block of the first dismiss call delegate that will execute the second dismiss.
Solution 5:
I got the same issue when i tried to present a VC which called inside the SideMenu(jonkykong).
first i tried inside the SideMenu and i called it from the delegate to the MainVC both had the same issue.
Solution: dismiss the SideMenu first and present the new VC after will works perfectly!.