堆栈跟踪或有关 Xcode/iPhone 中未处理异常的更多信息 [英] Stack trace or more info on unhandled exception in Xcode/iPhone

查看:45
本文介绍了堆栈跟踪或有关 Xcode/iPhone 中未处理异常的更多信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我的无知,但在 iPhone 模拟器中运行 iPhone 应用程序时,Xcode 调试器一直困扰着我.

Excuse my ignorance, but something's been bugging me about the Xcode debugger when running iPhone applications in the iPhone Simulator.

有时,当我在 Interface Builder 中搞砸了一些东西时,我会在运行时收到一个未处理的异常,然后我被扔回 Xcode.我唯一看到的是一行未捕获的异常"或类似的东西.据我所知,没有其他信息,更不用说堆栈跟踪或其他任何有用的信息了.

Sometimes, when I mess something up in Interface Builder, I get an unhandled exception at runtime and I get thrown back to Xcode. The only thing I see is a single line "uncaught exception" or something like that. From what I can see, there's no additional information, let alone a stack trace or anything else that's useful.

在过去十年左右的时间里,我一直在 Visual Studio 中进行开发,并且我习惯于在发生此类事情时获得良好的堆栈跟踪和完整的异常信息.

I have been developing in Visual Studio for the last decade or so, and I'm used to getting a nice stack trace and complete exception info when something like that happens.

我确定我只是遗漏了一些非常明显的东西......希望......

I'm sure I'm simply missing something very obvious... Hopefully...

推荐答案

如果添加两个断点,您应该能够调试这些异常.为此,请转到运行 |显示 |断点并创建两个全局断点(我全局执行它们,因为它们在我的所有应用程序中都非常有用).第一个应命名为objc_exception_throw",其位置应为libobjc.A.dylib".第二个应该是-[NSException raise]",它的位置应该是CoreFoundation".

If you add two breakpoints, you should be able to debug these exceptions. To do this, go to Run | Show | Breakpoints and create two global breakpoints (I do them globally because they are so useful in all my applications). The first should be named "objc_exception_throw" and its location should be "libobjc.A.dylib". The second should be "-[NSException raise]" and its location should be "CoreFoundation".

现在,如果您在启用断点的情况下开始调试您的应用程序,它应该会在抛出这些异常时中断.然后,您应该能够在调试器中看到导致异常的事件链.

Now, if you start debugging your application with breakpoints enabled, it should break on the throw of these exceptions. You should then be able to see the chain of events that led to the exception within the debugger.

这篇关于堆栈跟踪或有关 Xcode/iPhone 中未处理异常的更多信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆