ios - 如何用断点导航器中的定义替换 NSUncaughtExceptionHandler?

标签 ios xcode swift breakpoints nsexception

到目前为止,我在代码中使用了 NSUncaughtExceptionHandler:

void uncaughtExceptionHandler(NSException *exception) {
    NSLog(@"*************************************************");
    NSLog(@"CRASH: %@", exception);
    NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
    NSLog(@"*************************************************");
}

NSUncaughtExceptionHandler *exceptionHandlerPtr = &uncaughtExceptionHandler;

我知道在 Xcode 中我可以为所有异常添加异常断点:

enter image description here

然后我可以编辑断点:

enter image description here

最后我不知道如何配置它来替换我来自 NSUncaughtExceptionHandler 的代码。

enter image description here

最佳答案

来自 WWDC 15 - Advanced Debugging and the Address Sanitizer 的最简单的解决方案.

enter image description here

示例输出为:

enter image description here

您还可以阅读 Xcode: One Weird Debugging Trick That Will Save Your Life

关于ios - 如何用断点导航器中的定义替换 NSUncaughtExceptionHandler?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31471312/

相关文章:

android - Delphi Firemonkey iOS后台处理

ios - Swift:如何编写采用可选序列类型的枚举变体

ios - UICollectionView 初始化后不滚动

ios - Xcode - 创建 LLDB 目标时出错

swift - 为什么是我的代表?即使我的选择器一如既往地查看数据,也发现为零?

ios - 有没有一种方法可以像 Xcode 中的函数一样代码折叠属性?

ios - 如何为 CAShapeLayer 的填充设置动画?

ios - Meteor - 如何检测应用程序是否已打开?

ios - Segue 标识符未显示在属性检查器中

ios - 组合两个 TableViewController