App freeze on ios 8 when push or pop

最后都变了- 提交于 2020-01-21 03:19:28

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!