SIGABRT错误的调试办法

iOS经常会遇到一个头疼的error就是在main函数上显示“ Thread 1: signal SIGABRT ”这个错误,终于在stackoverflow上找到了调试的办法:

 

原文链接: http://stackoverflow.com/questions/9782621/i-have-an-error-in-main-m-thread-1-signal-sigabrt-how-can-i-fix-this

 

重点就是 Set an exception breakpoint.

 之前我们遇到的在main函数上的那个崩溃信息,如果想要调试就加入一个 an exception breakpoint ,它会在exception 被 cathc 的时候停下来,这样就可以追踪到造成 exception 的代码了。 

加入一个exception breakpoint的方法就是:在navigator的断点页面,点击左下角的加号就能看到 exception breakpoint;

加入的时候可以设置,默认是 all,也可以选择针对 oc 还是 c 的断点。

 

原文:

 

When you get SIGABRT on that line of main, it means that your program is raising an exception. The stack trace shows where the exception is being caught, not where it's being raised. Usually this is not helpful. To debug the problem, you can do two things:  

1.  Click the “Continue Program Execution” button in the debugger control bar, or choose Program > Debug > Continue from the menu bar. This will let the program continue the exception-raising process. It will print a message to the debugger console that will help you understand what's wrong. (You may have to continue execution a couple of times before it actually prints messages.) Read the messages carefully! They usually continue helpful information.    

2. Set an exception breakpoint. This will make Xcode stop your program at the point where the exception is being raised, so you can see the code and the stack trace that is causing the problem.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值