当推或弹时应用程序冻结在ios 8上 [英] App freeze on ios 8 when push or pop
问题描述
我的应用有一个大问题。主要在iOS 8上,因为我们还没有在其他iOS版本上找到它。
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.
更新:
当应用程序冻结时,内存,CPU和磁盘使用率都正常。
update: The memory, CPU and disk usage are all normal when the app freeze.
推荐答案
<我们终于解决了这个问题。原因是当视图控制器堆栈只有一个视图控制器时,我们没有禁用 interactivePopGestureRecognizer
。添加检查将解决问题。请参阅下面的代码。
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;
}
}
}
这篇关于当推或弹时应用程序冻结在ios 8上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!