如何追查乙型肝炎的原因

时间:2022-12-20 19:19:39

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.

我给这个问题展示了代码,但实际上我的问题是:我应该如何跟踪和理解SIGABRT错误?我读到这个问题:sigabrt没有错误信息,但是我不认为这与我的问题有关。

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.

下面我将展示的示例显然不是xib问题,以前获得SIGABRT似乎更多地与未处理的异常有关。我尝试过使用GDB的bt,但这没有帮助。难道没有更全面的转储可以查看吗?我也使用过NSZombie,但是我不知道如何使用它,所以如果这是你的答案,请提供一个关于如何从它中获得相关数据的文档链接。

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

这是我的例子:我正在尝试使用核心数据。我的项目最初不是用它来设置的,所以我必须手动添加它,这是我在项目>构建阶段的>链接二进制文件,使用库>单击加号并添加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

然后,我创建了我的数据模型,通过文件>新的>数据模型。我创建了一些属性,仅此而已

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):

之后,我给app委托添加了合适的方法(我用Core Data创建了一个新的项目,然后将方法复制过来):

//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

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

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

如何追查乙型肝炎的原因

1 个解决方案

#1


72  

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.

当对象接收到未实现的消息时,SIGABRT将上升。你的应用有多少警告?尝试浏览它们,找到那些警告你“某些对象可能不会响应某些选择器”的对象,如果你将你的应用从所有这些中清除,你很可能会让它正常工作。

EDIT: 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.

好,重炮来了——你试过使用断点吗?在project explorer中打开第6个选项卡,在左下角的tap + ->添加异常断点->完成。这将添加一个异常处理程序,该处理程序将在崩溃应用程序的方法调用上停止应用程序。

EDIT: 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.

编辑:从xCode 5.0 >开始,您不再需要指定在创建断点时您的断点将捕获到哪个异常。只需点击+ ->添加异常断点就可以了。

如何追查乙型肝炎的原因

#1


72  

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.

当对象接收到未实现的消息时,SIGABRT将上升。你的应用有多少警告?尝试浏览它们,找到那些警告你“某些对象可能不会响应某些选择器”的对象,如果你将你的应用从所有这些中清除,你很可能会让它正常工作。

EDIT: 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.

好,重炮来了——你试过使用断点吗?在project explorer中打开第6个选项卡,在左下角的tap + ->添加异常断点->完成。这将添加一个异常处理程序,该处理程序将在崩溃应用程序的方法调用上停止应用程序。

EDIT: 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.

编辑:从xCode 5.0 >开始,您不再需要指定在创建断点时您的断点将捕获到哪个异常。只需点击+ ->添加异常断点就可以了。

如何追查乙型肝炎的原因