问题
My app has one big problem. Mainly on iOS 8 because we have not found this on other iOS versions.
It will freeze sometimes when push to a new view controller or pop to a previous view controller. But something strange is if you press home button and launch the app from background. It will run a little. Here I mean the new pushed or popped view controller appeared but you still could not push or pop new view controllers.
update: The memory, CPU and disk usage are all normal when the app freeze.
回答1:
We have solved this problem finally. The reason is we have not disabled the interactivePopGestureRecognizer
when the view controller stack have only 1 view controller. Add the check will solve the problem. See code bellow.
- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animate
{
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
if (self.viewControllers.count > 1)
{
self.interactivePopGestureRecognizer.enabled = YES;
}
else
{
self.interactivePopGestureRecognizer.enabled = NO;
}
}
}
来源:https://stackoverflow.com/questions/26674279/app-freeze-on-ios-8-when-push-or-pop