如何跟踪SIGABRT的原因 [英] How to track down cause of SIGABRT

查看:138
本文介绍了如何跟踪SIGABRT的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我出于示例目的显示此问题的代码,但我的问题是:我应该如何跟踪并了解SIGABRT错误?我阅读了这个问题: sigabrt没有错误消息,但我不认为这关于我的问题。

I'm showing the code to this problem for example purposes, but really my question is: how am I supposed to track down and understand SIGABRT errors? I read this question: sigabrt with no error message, however I don't think this pertains to my problem.

下面显示的示例显然不是一个xib问题,以前获取SIGABRT似乎与未处理的异常更相关。我试过使用GDB的 bt 但这没有什么帮助。是否没有更全面的转储来查看?我也使用了 NSZombie ,但我真的不明白如何使用它,所以如果这是你的答案,请提供一个链接,从中获取相关数据。

The example I'll show below is obviously not a xib problem, and prior times getting SIGABRT seemed more to do with unhandled exceptions. I have tried using GDB's bt but this does not help. Is there not a more comprehensive dump to view? I have also used NSZombie, but I really don't understand how to use it, so if that is your answer, please provide a link to documentation on how I'm supposed to get relevant data from it.

这里是我的例子:我试图使用Core Data。我的项目最初没有设置它,所以我不得不手动添加它,我做了我去项目>构建阶段>链接二进制库>单击加号和添加CoreData.framework

Here's my example: I'm trying to use Core Data. My project was not originally set up with it, so I have had to manually add it, which I did by going to my project>Build Phases>Link Binary with Libraries>clicking the plus and adding CoreData.framework

然后,我通过转到文件>新建>数据模型创建了我的数据模型。我创建了很多属性,这是它

Then I created my data model by going to File>New>Data Model. I created quite a few attributes and that's it

之后,我添加了适当的方法到应用程序委托(我这样做通过创建一个新的项目与Core Data,然后复制方法):

After that, I added the proper methods to the app delegate (I did this by creating a new project with Core Data, then copying the methods over):

//code removed, as its not needed for the question/answer

之后,我只是尝试保存一个值到托管对象(再一次,代码从默认实现中复制一个新项目):

After this I just tried to save a value to the managed object (once again, code copied from the default implementation with a new project):

//code removed, as its not needed for the question/answer

但是我执行 addTime 方法时得到的是SIGABRT错误。

But all I get when I execute the addTime method is the SIGABRT error.

推荐答案

当对象接收未实现的消息时,SIGABRT上升。您的应用程式有多少警告?尝试浏览他们,找到那些警告你一些对象可能不响应一些选择器,如果你清理你的应用程序从所有这些,你很可能会正常工作。

SIGABRT rises when an object receives unimplemented message. How many warnings does your app have? Try surfing through them and find the ones that warn you "some object may not respond to some selector", if you clean your app from all of these, you'll most probably get it working correctly.

编辑:从以下评论回答非常有帮助:

Answer from comments below which are very helpful:


确定,这里是重炮使用断点?打开
项目浏览器中的第六个选项卡,在左下角点击
+ - >添加异常断点 - >完成。这将添加一个异常处理程序,将在应用程序崩溃
的方法调用上停止应用程序。

ok, here goes heavy artillery - have you tried using breakpoints? Open the sixth tab in your project explorer, in the bottom left corner tap + -> Add exception breakpoint -> Done. This will add an exception handler that will stop your app on the very method call that crashes the app.

从xCode 5.0开始>您不再需要指定哪些异常是您的断点将在创建断点时捕获。你只需要按+ - >添加异常断点,你就是好的。

As of xCode 5.0 > You no longer need to specify which exception is your breakpoint is going to catch while the breakpoint is being created. You just need to hit + -> Add exception breakpoint and you're good.

这篇关于如何跟踪SIGABRT的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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