AppDelegate 中的应用 SIGABRT

Posted

技术标签:

【中文标题】AppDelegate 中的应用 SIGABRT【英文标题】:App SIGABRTs on AppDelegate 【发布时间】:2016-12-13 22:58:56 【问题描述】:

我正在尝试调试我的应用程序的界面,但它在启动时立即崩溃:

libc++abi.dylib: terminating with uncaught exception of type NSException

当我在调试窗格中输入bt

* thread #1: tid = 0x145ce, 0x00000001917e74bc libsystem_c.dylib`__abort + 176, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1917e74bc)
  * frame #0: 0x00000001917e74bc libsystem_c.dylib`__abort + 176
    frame #1: 0x00000001917e740c libsystem_c.dylib`abort + 152
    frame #2: 0x00000001912b12d4 libc++abi.dylib`abort_message + 132
    frame #3: 0x00000001912cecc0 libc++abi.dylib`default_terminate_handler() + 304
    frame #4: 0x00000001912dc844 libobjc.A.dylib`_objc_terminate() + 124
    frame #5: 0x00000001912cb66c libc++abi.dylib`std::__terminate(void (*)()) + 16
    frame #6: 0x00000001912cb234 libc++abi.dylib`__cxa_rethrow + 144
    frame #7: 0x00000001912dc71c libobjc.A.dylib`objc_exception_rethrow + 44
    frame #8: 0x000000019277e32c CoreFoundation`CFRunLoopRunSpecific + 560
    frame #9: 0x0000000194232198 GraphicsServices`GSEventRunModal + 180
    frame #10: 0x00000001987c57fc UIKit`-[UIApplication _run] + 684
    frame #11: 0x00000001987c0534 UIKit`UIApplicationMain + 208
    frame #12: 0x00000001001ab6b0 AppName`main + 140 at AppDelegate.swift:30
    frame #13: 0x00000001917615b8 libdyld.dylib`start + 4

有没有办法让我获得比这更有用的信息来解决我的问题。我已经在this 页面上尝试了所有内容。

关于如何调试 Interface Builder 文档的任何提示?

【问题讨论】:

您是否在 Xcode 中设置了断点来捕获 C++ 和 ObjC 未处理的异常? 是的,设置了符号断点并且一旦命中,它就会突出显示我的 AppDelegate 的声明。 Always stop in App delegate after enabling All exceptions break point的可能重复 不。实际上,我只是在捕获 Obj-C 异常,但是,自从您发表第一条评论以来,我也尝试了 All(Obj-C 和 C++)。我回到只用我的符号断点捕获 Obj-C 异常。 【参考方案1】:

原来我抛出了一个unrecognized selector sent to instance 0xABC123 异常。我只是发现了这一点,因为我使用了内联闭包:

NSSetUncaughtExceptionHandler  exception in
    print(exception)
    print(exception.callStackSymbols)

在我的 AppDelegate 中的 application(_:didFinishLaunchingWithOptions:) 方法的末尾。由于某种原因,象征性的任何异常断点都没有为我提供相同数量的细节。

【讨论】:

以上是关于AppDelegate 中的应用 SIGABRT的主要内容,如果未能解决你的问题,请参考以下文章

Swift - 当应用程序进入后台状态时,从 AppDelegate 更新 RootViewController 中的值

AppDelegate 中的 Swift UITabbar 阴影

AppDelegate 类不适用于 iOS Swift 应用程序中的 Obj-C 嵌入式库

使用 AppDelegate 中的可达性块检查整个应用程序的连接性

AppDelegate 中的异常断点

如何解决 AppDelegate 中的 coreData 错误?