objective-c - 呈现 Modal ViewController 会导致 SIGABRT

标签 objective-c ios xcode ipad sigabrt

我初始化一个 UINavigationController用我的自定义UIViewController子类。但是只要我想展示 View Controller ,我就会得到一个 SIGABRT Xcode 中的错误。我以前做过很多次,我认为这个问题的存在是因为在我当前的项目中可能不正确的其他事情。但是,我发现很难找到这种现象背后的问题。那么有没有一些你可以做的事情以某种方式阻止模态视图 Controller 的呈现?

这就是我展示我的 View Controller 的方式:

- (IBAction)tutorialTouched:(id)sender {

    TutorialViewController *tutorialVC = [[TutorialViewController alloc]init];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:tutorialVC];
    nav.modalPresentationStyle = UIModalPresentationFormSheet;

    // This line leads to `SIGABRT`
    [self presentModalViewController:nav animated:NO];
}

部署目标是 5.0。

更新:
这是我输入 bt 时得到的信息进入控制台:
#0  0x945919c6 in __pthread_kill ()
#1  0x9645bf78 in pthread_kill ()
#2  0x9644cbdd in abort ()
#3  0x003169dc in uncaught_exception_handler ()
#4  0x032010fc in __handleUncaughtException ()
#5  0x02f00f0f in _objc_terminate ()
#6  0x0349e8de in safe_handler_caller ()
#7  0x0349e946 in std::terminate ()
#8  0x0349fb3e in __cxa_rethrow ()
#9  0x02f00e15 in objc_exception_rethrow ()
#10 0x03137de0 in CFRunLoopRunSpecific ()
#11 0x03137c9b in CFRunLoopRunInMode ()
#12 0x035ca7d8 in GSEventRunModal ()
#13 0x035ca88a in GSEventRun ()
#14 0x016b3626 in UIApplicationMain ()
#15 0x00002fad in main (argc=1, argv=0xbffff5a8) at /Users/myProject/main.m:14

最佳答案

该问题是由于我的 ViewController 中的 Outlet 错误引起的。我无法弄清楚,因为编译器从未告诉我这一点。只有当我添加了 try / catch围绕 View Controller 的呈现,我得到了异常对象,它最终告诉我出了什么问题。很抱歉造成困惑,感谢您的帮助。

关于objective-c - 呈现 Modal ViewController 会导致 SIGABRT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10280223/

相关文章:

ios - ObjectiveRecord nil模型错误

objective-c - 从 Interface Builder 连接 NSMenuItems 的最佳方式?

ios - iBeacons : how to get broadcasted beacon power (txPower)

c++ - C++ 静态类 : undefined symbols 的 Clang 链接错误

ios - 在 UiCollectionView 中处理触摸?

ios - 使用 Swift 添加贴纸背景颜色

swift - 在多个目标中重用本地 Swift 包

ios - UITabBarItem 外观抛出 EXC_BAD_ACCESS

objective-c - 显示用户位置的问题

iOS Objective-C/Swift 下载时读取文件