举个例子,我展示了这个问题的代码,但实际上我的问题是:我应该如何追踪和理解SIGABRT错误?我读到这个问题:sigabrt with no error message,但我认为这与我的问题无关.

我将在下面展示的示例显然不是xib问题,之前获得SIGABRT似乎更多地与未处理的异常有关.我try 过使用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

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

之后,我向app delegate添加了正确的方法(我使用核心数据创建了一个新项目,然后复制了这些方法):

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

在这之后,我只是try 将一个值保存到托管对象(再次使用新项目从默认实现复制的代码):

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

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

xcode error

推荐答案

当一个对象收到未实现的消息时,SIGABRT上升.你的应用程序有多少警告?try 浏览它们,找到那些警告你"某些对象可能不会响应某些 Select 器"的,如果你从所有这些中清除应用程序,你很可能会让它正常工作.

编辑:下面的 comments 非常有用:

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.

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.

enter image description here

Objective-c相关问答推荐

NSViewController 中的 viewDidLoad?

如何更改 UIButton 的突出显示 colored颜色 ?

NSPredicate 与整数比较

setFont 已弃用?

如何构建一个 Objective-C 静态库?

BSXPCMessage 收到消息错误:连接中断

如何判断 Cocoa 和 Objective-C 中是否存在文件夹?

Objective C 静态类变量

我们可以在 UIPageViewController 中自定义页面指示器吗?

以编程方式创建 UITableView

Apple 的 API 中的k前缀表示什么?

隐藏 NSTableView 标头?

既然我正在使用 Core Data,如何对我的模型进行单元测试?

检测 UITableView 滚动

架构 i386 clang 的重复符号

在 UITableView 的 iOS 文档目录中列出保存的文件?

如何配置我的应用程序 - 菜单项被禁用?

Objective-c - CABasicAnimation 在动画后应用更改?

Objective-C in,out,inout,byref,byval, .. 等等.这些是什么?

如何在 Objective-C 中创建可变参数方法