Crash with instantiateViewControllerWithIdentifier

我与影子孤独终老i 提交于 2019-12-12 03:19:44

问题


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:


回答1:


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.



来源:https://stackoverflow.com/questions/9367715/crash-with-instantiateviewcontrollerwithidentifier

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!