Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App freeze on ios 8 when push or pop

Tags:

ios

ios8

freeze

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.

like image 307
sunkehappy Avatar asked Oct 31 '14 12:10

sunkehappy


Video Answer


1 Answers

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;
        }
    }
}
like image 116
sunkehappy Avatar answered Nov 15 '22 19:11

sunkehappy