exception
Closed this issue · 4 comments
TanXingLiu commented
fatal error: unexpectedly found nil while unwrapping an Optional value
fruitcoder commented
Had this too in line 53 in DemoTableViewController
s scrollViewDidScroll:
when interactively dismissing, presenting and dismissing again
akring commented
Same problem,and @fruitcoder get the way to recreate it.
fatal error: unexpectedly found nil while unwrapping an Optional value
akring commented
It seems that I fixed this by adding the button animation to the main thread:
for case let viewController as TrendDramaVC in navigationController!.viewControllers {
if case let rightButton as AnimatingBarButton = viewController.navigationItem.rightBarButtonItem {
dispatch_async(dispatch_get_main_queue(), {
rightButton.animationSelected(false)
})
}
}
popTransitionAnimation()
MikePT28 commented
Consider fixing it with a more "Swifty approach"
override func scrollViewDidScroll(scrollView: UIScrollView) {
if scrollView.contentOffset.y < -25 , let navigationController = navigationController {
// buttonAnimation
for case let viewController as DemoViewController in navigationController.viewControllers {
if case let rightButton as AnimatingBarButton = viewController.navigationItem.rightBarButtonItem {
rightButton.animationSelected(false)
}
}
popTransitionAnimation()
}
scrollOffsetY = scrollView.contentOffset.y
}