如何防止在默认设置下释放 NSManagedObject
我对 xcode 的陌生已经让我为这个问题绞尽脑汁两天了,我在 google 上搜索过并感觉稍微相关的东西似乎都不起作用。我发现这是一个非常常见的问题,通常与 NSManagedObject 在不应该释放的时候被释放有关。由于 3 个原因,我的问题让我更加困惑:
- 我没有编辑 appdelegate 文件中的核心数据代码。这和它的设置完全一样。
- 我设置了 NSArrayController 条目,在界面生成器中使用绑定添加 - 而不是键入代码。我不明白它如何使用非常自动化的建立模型的方式如此容易地崩溃。
- 我没有运气从启用的控制台、调试器或僵尸模式中获得线索。我得到的只是: “程序收到信号:“EXC_BAD_ACCESS”。 sharelibrary apply-load-rules all”
我一直在关注步骤 13 中的教程: http://cocoadevcentral.com/articles/000085.php#13 与我自己的设置一起工作。我使用相同的确定按钮来添加数据。
我不会在这里发布我的 appDelegate.m 代码,因为我没有向其中添加任何内容,或者足够熟悉要隔离的代码部分(如果我要在此处显示它)。
基本上,我希望有人可能会在我正在遵循的教程中看到可能导致崩溃的问题?每次我点击“确定”从我填写的字段中添加数据时,它都会崩溃(再次,请参阅有关如何在界面生成器中链接这些字段的教程)。到目前为止,我只设置了一个 NSArrayObject 来处理 Core Data,所以我知道是哪个 NSArrayObject 导致了问题。
谢谢!
My newness to xcode has had me scratching my head over this problem for 2 days now and anything I've googled and feels slightly related doesn't appear to work. I see this is a very regular problem and it's usually to do with NSManagedObject being released when it shouldn't be. My problem is extra puzzling to me because of 3 reasons:
- I haven't edited the Core Data code in my appdelegate file. It's exactly as it was set up.
- I set up the NSArrayController entry adding using bindings in interface builder - not typed code. I don't understand how it crashes this easily using a very automated way of establishing the model.
- I'm not having any luck getting clues from the console, debugger or zombie mode enabled. All I get is:
"Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all"
I've been following the tutorial from step 13 here:
http://cocoadevcentral.com/articles/000085.php#13
to work with my own set up. I'm using the same ok button to add data.
I'm not posting my appDelegate.m code here as I haven't added anything to it or am familiar enough with what part of the code to isolate if I'm to show it here.
Basically, I'm hoping that someone might see a problem in that tutorial I'm following that may cause a crash? It crashes without fail every single time I hit ok to add data from the fields I've filled in (again, see the tutorial as to how I linked up these fields in interface builder). I've only set up a single NSArrayObject to work with Core Data so far so I know which one is causing the problem anyway.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
崩溃是由我创建的一个旧类引起的,该类访问了显示核心数据结果的 NSTableView。我已将其注释掉,这样它就不会妨碍我,直到我稍后必须再次使用它,但它似乎仍然妨碍我。删除它后,崩溃就停止了。
The crashing was caused by an older class I'd made that accessed the NSTableView that was showing results from the Core Data. I'd commented it out so that it wouldn't get in the way now until I had to use it again later, but it seems as though it was still getting in the way. With it removed, the crashes have stopped.