This is my first application for iOS.
So I have a UIVIewController
with a UITableView
where I have integrated a UISearchBar
and a
I faced the same kind of problem What I did is from Interface builder selected my segue Its kind was "Present Modally" and its presentation was "Over current context"
i changed the presentation to "Default", and then it worked for me.
In my case I was trying to present a UIAlertController
at some point in the app's lifetime after using a UISearchController
in the same UINavigationController
.
I wasn't using the UISearchController
correctly and forgot to set searchController.isActive = false
before dismissing. Later on in the app I tried to present the alert but the search controller, though not visible at the time, was still controlling the presentation context.
My problem was that (in my coordinator) i had presented a VC
on a VC
and then when i wanted to present the next VC(third one), presented the third VC from the first one which obviously makes the problem which is already presenting
.
make sure you are presenting the third one from the second VC
.
secondVC.present(thirdVC, animated: true, completion: nil)
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
.
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.
In my case this was an issue of a button which was duplicated in Interface Builder. The original button had a touch-up handler attached, which also presented a modal view. When I then attached a touch-up handler on the copied button, I forgot to remove the copied handler from the original, causing both handlers to be fired and thus creating the warning.