Search code examples
iosuisearchcontroller

Cannot perform unwind segue on selecting search result - the navigation stack will not be updated


I have two view controllers, the first one(VC1) has a button and when click on that it will navigate to the second view controller(VC2). VC2 is a table view includes a list of names and it has search bar on top for searching. If I select a cell normally, it will call to unwind segue to pop back to VC1. However, if I search for a name, and then on the search result, I select a cell, it cannot perform that unwind segue, it just dismisses the search UI and result an error like this:

popToViewController:transition: called on UINavigationController while an existing transition or presentation is occurring; the navigation stack will not be updated.

I also try to dismiss the VC2 on tableview:didSelectCellAtIndex but no use.

Any help would be appreciated!!!


Solution

  • Try to use the following function:

    [self.navigationController popViewControllerAnimated:YES];