与instantiateViewControllerWithIdentifier崩溃 [英] Crash with instantiateViewControllerWithIdentifier

查看:404
本文介绍了与instantiateViewControllerWithIdentifier崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让一个UISplitViewController工作使用一个故事板,但是当我尝试实例化我的主ViewController我的应用程序崩溃与隐藏EXC_BAD_ACCESS和反汇编。



我在UISplitViewController的子类中有一个属性 splitNavVc ,在我的故事板中我有下面的设置。 splitNavVc 位于左侧,是UINavigationController的子类。问题是,在加载视图后尝试实例化splitNavVc后,应用程序崩溃。要实例化,我正在使用

  if(!detailVc){
detailVc = [self.storyboard instantiateViewControllerWithIdentifier: @DetailVc];
}
if(!splitNavVc){
splitNavVc = [self.storyboard instantiateViewControllerWithIdentifier:@SplitMenu]; // crash
}
[self setViewController: NSArray arrayWithObjects:splitNavVc,detailVc,nil]];

有没有办法跟踪异常的原因? EXC_BAD_ACCESS 没有特别描述。





没有堆栈跟踪转储到控制台(lldb),但这是错误:

解决方案

奇怪的是,当我将XCode中的调试器从LLDB到GDB。我使用LLVM作为编译器,如果这有所作为。


I'm trying to get a UISplitViewController to work using a storyboard, but when I try to instantiate my master ViewController my app crashes with a cryptic EXC_BAD_ACCESS and a disassembly.

I have a property, splitNavVc on my subclass of UISplitViewController, in my storyboard I have the setup below. splitNavVc is on the left hand side and is a subclass of UINavigationController. The problem is, after trying to instantiate the splitNavVc when the view loads, the app crashes. To instantiate it, I'm using

if(!detailVc){
    detailVc = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailVc"];   
}
if(!splitNavVc){
    splitNavVc = [self.storyboard instantiateViewControllerWithIdentifier:@"SplitMenu"];// crash
}
[self setViewControllers:[NSArray arrayWithObjects:splitNavVc, detailVc, nil]];

Is there any way I can track down the cause of the exception? EXC_BAD_ACCESS isn't particularly descriptive.

There's no stack trace dumped to the console (lldb), but this is the error:

解决方案

Bizarrely, this seemed to stop happening when I switched the debugger in XCode from LLDB to GDB. I'm using LLVM as the compiler if that makes a difference.

这篇关于与instantiateViewControllerWithIdentifier崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆