我如何知道在Xcode调试器(iPhone)中抛出什么异常? [英] How do I find out what exception was thrown in the Xcode debugger (for iPhone)?

查看:120
本文介绍了我如何知道在Xcode调试器(iPhone)中抛出什么异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从Erica Sadun的iPhone开发者手册中学习iPhone编程。当我运行我创建的应用程序,按照模拟器中第81页开始的温度转换示例中的步骤,由于未捕获的异常而终止。 (请参阅 http://groups.google.com/group/iphonesdk / browse_frm / thread / 6f44a90fdb8da28a?hl = en 发布到iPhoneSDK Google Group的问题。)



调用UIApplicationMain()后抛出异常,从我的主()。如果我查看调试器中的堆栈跟踪,我看到的(当然)汇编。如何找出抛出什么样的异常?



更新:从调试器控制台了解异常的详细信息足以帮助我解决问题。 (请参阅 http://groups.google.com/group/iphonesdk / browse_frm / thread / 6f44a90fdb8da28a?hl = en 。)我验证了我可以在 objc_exception_throw 上设置一个符号断点,但是我没有看到是否

解决方案

将断点放在 objc_exception_throw 并通过调试运行您的应用程序,而不是运行



要澄清一点,当您没有断点获得异常时,您实际看到的是一致的堆栈跟踪 - 这是未捕获的异常处理程序。异常的类型被记录到运行控制台,但是如果你想看到异常引发的地方,那就是断点是什么。


I'm learning iPhone programming from Erica Sadun's The iPhone Developer's Cookbook. When I run the app I created by following the steps in the Temperature Conversion Example starting on page 81 in the simulator, it terminates due to an uncaught exception. (See http://groups.google.com/group/iphonesdk/browse_frm/thread/6f44a90fdb8da28a?hl=en for the question I posted to the iPhoneSDK Google Group.)

The exception is thrown after calling UIApplicationMain() from my main(). If I look through the stack trace in the debugger, all I see is (of course) assembly. How do I find out what kind of exception was thrown?

Update: Learning the details of the exception from the Debugger Console was enough to help me solve the problem. (See http://groups.google.com/group/iphonesdk/browse_frm/thread/6f44a90fdb8da28a?hl=en.) I verified that I could set a symbolic breakpoint on objc_exception_throw, but I didn't look to see if the backtrace from there would have been helpful.

解决方案

Put a breakpoint at objc_exception_throw and run your app via Debug instead of Run

To clarify, what you're actually seeing when you get an exception without the breakpoint is the same stack trace always - it's the uncaught exception handler. The type of exception is logged to the Run console, but if you want to see a backtrace for where the exception was raised, that's what the breakpoint is for.

这篇关于我如何知道在Xcode调试器(iPhone)中抛出什么异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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