marty-suzuki / SAHistoryNavigationViewController

SAHistoryNavigationViewController realizes iOS task manager like UI in UINavigationContoller. Support 3D Touch!
MIT License
1.57k stars 91 forks source link

Warning when going back and a tabbar controller has been pushed #34

Closed pepejeria closed 8 years ago

pepejeria commented 8 years ago

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

Consider the following scenario in storyboards:

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.

marty-suzuki commented 8 years ago

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

pepejeria commented 8 years ago

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

marty-suzuki commented 8 years ago

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)
        }
    }
}
pepejeria commented 8 years ago

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