I am using a subclassed UINavigationController which manages all the viewControllers in my app. It pushes and pops viewControllers in the main flow and presents and dismisses modally those viewControllers which are required arbitrarily.
In one case, I need to present a viewController modally before popping another in the main flow, like so:
//Called in custom UINavigationController subclass
[self presentViewController:searchVC animated:YES completion:^{
[self popViewControllerAnimated:NO];
}];
The above code used to work without a hitch till iOS 8, and does not work in iOS 9. The same viewController as before remains when the presented vc is dismissed.
Also, this is being logged in the console:
popViewControllerAnimated: called on <CustomNavigationController 0x7d846600> while an existing transition or presentation is occurring; the navigation stack will not be updated.
This was never an issue till now, especially since the popViewController method is called in the completion block.
Could this be a bug?
Any solution/suggestion/workaround is welcome.
Wrapping the popViewController call in an dispatch_async
block worked.
[self presentViewController:searchVC animated:YES completion:^{
dispatch_async(dispatch_get_main_queue(), ^{
[self popViewControllerAnimated:YES];
});
}];