崩溃后 Xcode 总是在 main.m 处停止 [英] Xcode always stopping at main.m after a crash

查看:13
本文介绍了崩溃后 Xcode 总是在 main.m 处停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去,使用旧的和好的Xcode 3,每次我发生崩溃时,Xcode都会停在显示崩溃的违规行处.这是美好的时光,很高兴调试.

现在使用 Xcode 4.2,每次应用程序崩溃时,它都会停在 main.m 这一行

int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");

这不知道是什么导致了崩溃.问题可能出在任何类中,但它在崩溃时总是会在 main.m 上停止.

有没有办法让它再次正常工作?

谢谢

注意:我之前在 SO 上问过这个问题,但鉴于时间证明解决方案并不令人满意并且问题仍然存在.

解决方案

他们改变了行为,按照

点击Add Exception Breakpoint..."菜单项后,你会看到这个断点配置视图打开:

单击完成"按钮,您将在断点列表中出现新的异常断点.如果您想让所有 Xcode 工作区都包含异常断点,请右键单击(Ctrl + 单击)并打开Move Breakpoint To"菜单项:

在子菜单中点击User"后,您会看到异常断点在断点的用户组中.打开另一个项目,它会自动包含在断点列表中.

调试愉快!

In the past, with the old and good Xcode 3, every time I had a crash, Xcode stopped at the offending line showing the crash. It was good times, nice to debug.

Now with Xcode 4.2, every time the app crashes, it stops at main.m at this line

int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");

that gives no clue to what is causing the crash. The problem can be in any class but it will always stop on main.m when it crashes.

is there a way to make it work correctly again?

thanks

note: I have asked this before on SO, but the solution given that time was proved to be not satisfactory and the problem persists.

解决方案

They changed the behavior, follow this tutorial to break on all exceptions

EDIT:(Link might rot, so I will duplicate the info here)

One of the hidden gems in Xcode 4.2 is the "Exception Breakpoint" feature. Once you enable it, your debugging life becomes much easier because whenever an exception is thrown in your app, Xcode will bring up the line of code that caused the exception to occur. This is particularly useful if your call stack window is empty (which I have seen happen sometimes while working on iOS apps). Instead of relying on a brief error message in the Output pane, which doesn’t contain much more than the type of exception and its error message, you get to see exactly where the problem is!

You can add an Exception Breakpoint by opening up the Breakpoint Navigator pane, and clicking on the X button in the bottom left corner:

After clicking the "Add Exception Breakpoint…" menu item, you will see this breakpoint configuration view open up:

Click the Done button and you will the new Exception Breakpoint in your list of breakpoints. If you want to have all of your Xcode workspaces include the Exception Breakpoint, right-click (Ctrl + click) on it and open the "Move Breakpoint To" menu item:

After clicking "User" in the submenu, you will see that the Exception Breakpoint is in the User group of breakpoints. Open up another project and it automatically be included in the list of breakpoints.

Happy debugging!

这篇关于崩溃后 Xcode 总是在 main.m 处停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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