gpt4 book ai didi

ios - 我如何调试 : libc++abi. dylib : terminating with uncaught exception of type NSException?

转载 作者:搜寻专家 更新时间:2023-10-31 08:22:26 25 4
gpt4 key购买 nike

很抱歉问这个菜鸟问题,我知道这个问题之前已经被问过数千次了,我知道是因为我之前遇到过这个问题数千次。但这次谷歌没有帮助。

错误/终端打印:

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

我通常知道是什么类型的情况导致了这种情况,因为我过去遇到过这个问题并且修复起来非常简单,通常是函数命名错误或某些 UI 元素与我的代码之间的链接断开,但现在我有不知道是什么原因造成的。

我已经尝试过的:

我在起始 ViewController 上添加了大量断点,它通过了所有 @IBOutlets 而没有抛出任何问题。我在 AppDelegate 的所有方法中都添加了断点,它不会在那里的任何地方中断。代码在到达任何 viewDidLoad() 方法之前崩溃。我清理了我的项目,重新启动了 XCode 一千次,甚至破坏并重新建立了 UI 和代码之间的每个链接。重命名然后重新分配每个@IBAction。

在这一点上,我什至不知道我还没有尝试过什么。每个 stackoverflow 帖子总是关于同一件事“检查断开的链接等”,但这不再有帮助了。我不记得我改变了什么,因为在我开始收到这个错误之前我改变了很多小东西。我试着把所有东西都放回去,但这似乎没有帮助。

当应用程序崩溃时:

在“applicationDidBecomeActve()”完成后,调试器立即进入一堆机器代码,然后应用程序崩溃,我得到这个:

enter image description here

正确链接的证明:

[图片因不必要而被删除]

我的主要问题:

如果链接不是这里的问题,那还能是什么?

关于 NSLogs/堆栈跟踪

我很乐意提供某种 NSLog 或堆栈跟踪,因为我看到人们在其他问题上提出要求并给予帮助,但我不知道如何做。我在互联网上找不到任何关于如何打开它们的石器时代以外的内容。其他一切都只是如何使用调试器,但我正在使用调试器,我所得到的只是在机器指令中简要浏览我的代码,直到它最终崩溃。

编辑:

显然我只能在模拟器而不是物理设备上运行时才能获取日志。这是我在模拟器上运行时得到的日志:

objc[40258]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x123242998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x123067d38). One of the two will be used. Which one is undefined.
2016-11-04 16:26:47.463 KotConnect[40258:1345011] Unknown class ProgressViewContainer in Interface Builder file.
2016-11-04 16:26:47.500 KotConnect[40258:1345011] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x7fbfe3c0a030> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key loadingView.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001105ca34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000011002b21e objc_exception_throw + 48
2 CoreFoundation 0x00000001105ca299 -[NSException raise] + 9
3 Foundation 0x000000010fb3b26f -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4 UIKit 0x0000000110e0580d -[UIView(CALayerDelegate) setValue:forKey:] + 173
5 UIKit 0x000000011114f79e -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000011056f590 -[NSArray makeObjectsPerformSelector:] + 256
7 UIKit 0x000000011114e122 -[UINib instantiateWithOwner:options:] + 1867
8 UIKit 0x0000000110ee1c21 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
9 UIKit 0x0000000110ee2543 -[UIViewController loadView] + 177
10 UIKit 0x0000000110ee2878 -[UIViewController loadViewIfRequired] + 201
11 UIKit 0x0000000110f2307b -[UINavigationController _layoutViewController:] + 55
12 UIKit 0x0000000110f23963 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 471
13 UIKit 0x0000000110f23ada -[UINavigationController _startTransition:fromViewController:toViewController:] + 133
14 UIKit 0x0000000110f24ce5 -[UINavigationController _startDeferredTransitionIfNeeded:] + 874
15 UIKit 0x0000000110f25dc7 -[UINavigationController __viewWillLayoutSubviews] + 58
16 UIKit 0x000000011111cd6f -[UILayoutContainerView layoutSubviews] + 223
17 UIKit 0x0000000110e05f50 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
18 QuartzCore 0x0000000110ac3cc4 -[CALayer layoutSublayers] + 146
19 QuartzCore 0x0000000110ab7788 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x0000000110ab7606 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x0000000110a45680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
22 QuartzCore 0x0000000110a72767 _ZN2CA11Transaction6commitEv + 475
23 QuartzCore 0x0000000110a730d7 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
24 CoreFoundation 0x000000011056ee17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x000000011056ed87 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x00000001105534b6 CFRunLoopRunSpecific + 454
27 UIKit 0x0000000110d3b7e6 -[UIApplication _run] + 434
28 UIKit 0x0000000110d41964 UIApplicationMain + 159
29 KotConnect 0x000000010d52cc8f main + 111
30 libdyld.dylib 0x00000001135c968d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

最佳答案

swift

只需添加

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

AppDelegatedidFinishLaunchingWithOptions 方法的底部。它将为您提供有关发生的异常 的更好信息。快乐编码!

关于ios - 我如何调试 : libc++abi. dylib : terminating with uncaught exception of type NSException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40426200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com