MSMessagesAppViewController performing segues in expanded view Issues

60 views Asked by At

I'm writing a MSMessagesApp Extension and my compressed view controller shows up fine when I go into each possible avenue of an expanded view and back.

However, when I'm in the expanded view and performing segues, when I collapse to the compressed view, the compressed view is not being shown and what is being shown, is instead the last view that was modally displayed in my extended view.

I've tried adding the controller that is modally displayed on each segue to MessagesViewController via:

self.parent.addChildViewController(controllerThatIsBeingSeguedTo)

so that when I switch to compressed and MessagesViewController calls removeAllChildViewControllers shown below, the controllers I have segued to and from the expanded view will also be deleted and the compressed view controller will show.

`private func removeAllChildViewControllers() {
    for child in childViewControllers {
        child.willMove(toParentViewController: nil)
        child.view.removeFromSuperview()
        child.removeFromParentViewController()
    }
}`

However, I run into the error:

“Application tried to present modally an active controller”.

0

There are 0 answers