marty-suzuki/SAHistoryNavigationViewController

Warning when going back and a tabbar controller has been pushed

pepejeria opened this issue · 4 comments

The warning is: Unbalanced calls to begin/end appearance transitions for UITabBarController: 0x7fb91bd2a850.

Consider the following scenario in storyboards:

  • Have a navigation controller as the initial view controller wit a UIViewController
  • Add a button to the UIViewController that leads to a UITabbarController

Tap on the button to see the tabbar controller, then long press the back button to see the error above.

I can provide you a zip file if you want with this test case, no code involved, just storyboards.

Hi, @pepejeria
Would you like to give zip file to me?

I emailed you the test case to your gmail that can be see on the main page.

Thanks for your zip file.

Please rewrite this line like this.

Before

extension SAHistoryNavigationViewController: SAHistoryViewControllerDelegate {
    func historyViewController(viewController: SAHistoryViewController, didSelectIndex index: Int) {
        if viewControllers.count - 1 < index {
            return
        }

        popToViewController(viewControllers[index], animated: false)

        viewController.dismissViewControllerAnimated(true) { finished in
            self.historyViewController = nil
            self.setNavigationBarHidden(false, animated: false)
        }
    }
}

After

extension SAHistoryNavigationViewController: SAHistoryViewControllerDelegate {
    func historyViewController(viewController: SAHistoryViewController, didSelectIndex index: Int) {
        if viewControllers.count - 1 < index {
            return
        }

        viewController.dismissViewControllerAnimated(true) { finished in
            self.historyViewController = nil
            self.popToViewController(self.viewControllers[index], animated: false)
            self.setNavigationBarHidden(false, animated: false)
        }
    }
}

That fixes the issue, the warning no longer appear. Thanks!