instantiateViewControllerWithIdentifier 导致崩溃

发布于 2025-01-07 18:50:50 字数 861 浏览 2 评论 0原文

我正在尝试使用故事板让 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 setViewControllers:[NSArray arrayWithObjects:splitNavVc, detailVc, nil]];

有什么方法可以追踪异常的原因吗? EXC_BAD_ACCESS 并不是特别具有描述性。

Storyboard layout

没有堆栈跟踪转储到控制台 (lldb),但这是错误: 在此处输入图像描述

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.

Storyboard layout

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明月松间行 2025-01-14 18:50:50

奇怪的是,当我将 XCode 中的调试器从 LLDB 切换到 GDB 时,这种情况似乎不再发生。如果这有什么区别的话,我使用 LLVM 作为编译器。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文