self.navigationController pushViewController在iPad 8.1上卡住了

3

虽然下面这行代码在iPhone 7.1/8.1上可以正常工作,但在iPad上仅适用于7.1版本。在8.1版本上,内存使用量会不断增加,直到崩溃:

[self.navigationController pushViewController:detailController animated:YES];

这一行发生在这里:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    OBDialogDetailViewController* detailController = [[OBDialogDetailViewController alloc] initWithOption:(OBSelectionFilterOption*)option];
    [self animateChangeForView:nil atIndexPath:indexPath toRect:CGRectMake(0, 0, 0, 0) andNewHeight:0];
    if (self.navigationController)
    {
        [self.navigationController pushViewController:detailController animated:YES];
    }
}

由于我刚刚负责这个应用程序,它已经发展了多年,并且没有文档,所以我有点绝望。我已经搜寻并尝试了多个答案和解决方案,已经两天了。

请告诉我可以提供更多哪些信息。

在此输入图片描述


如果你将对 animateChangeForView... 的调用注释掉,问题是否仍然存在? - rdelmar
是的,问题依旧。 - Sascha Galley
你看到 detailController 了吗?它的 viewDidLoad 方法被调用了吗? - rdelmar
我也遇到了同样的问题,针对iOS 8.1。如果你找到解决方案,请更新! - Deepak Thakur
寻找包含如何使用HeapShot(在最新的Xcode Instruments中略有更名)的答案。或者查看bbum的博客文章。链接:http://www.friday.com/bbum/2010/10/17/when-is-a-leak-not-a-leak-using-heapshot-analysis-to-find-undesirable-memory-growth/ - zaph
显示剩余2条评论
1个回答

0

并非所有情况都会发生。但有几件事我想提一下:

  1. 我试图在UINavigationController的目标视图控制器上播放一个加密视频(大文件)。当我在viewDidLoad中加载它时,解密并将视频加载到该视图控制器的视图上需要时间。在这种情况下,请使用以下代码。

    [self performSelectorInBackground:@selector(createVideoPlayer) withObject:nil]; [self performSelectorInBackground:@selector(createVideoPlayerControllerView) withObject:nil];

  2. 即使您正在使用ARC,请参考this link以管理内存问题。

这可能不能直接回答您的问题,但肯定会帮助您进行调试。请发布您得到的任何解决方案。谢谢。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接