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

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

问题描述

在过去,使用旧的和良好的Xcode 3,每当我发生崩溃时,Xcode都停在显示崩溃的违规行。这是好时光,很好调试。



现在使用Xcode 4.2,每次应用程序崩溃时,它都会在此行的main.m处停止

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

没有提供导致崩溃的原因。问题可以在任何类中,但它会在它崩溃时在main.m上停止。



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



谢谢



注意:我之前在SO上问过这个问题,但考虑到时间的解决方案被证明并不令人满意问题仍然存在。

解决方案

他们改变了行为,按照



单击添加异常断点...菜单项后,您将看到此断点配置视图打开:





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





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





快乐的调试!


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天全站免登陆