简体   繁体   中英

App freeze on ios 8 when push or pop

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.

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;
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM