使用核心数据重新打开应用程序后 EXC_BAD_ACCESS

发布于 2025-01-05 16:27:16 字数 1974 浏览 4 评论 0原文

我有一个使用核心数据的应用程序。我能够在第一次在模拟器中构建和运行应用程序时保存和获取数据,但是,当我关闭应用程序、在模拟器中终止它并重新运行它时,它会崩溃并显示 EXC_BAD_ACCESS< /code> main 内部。

如果我在模拟器上卸载应用程序并再次运行它,一切都会再次正常工作,直到我关闭应用程序并在发生同样的事情时再次打开它。

在将核心数据添加到我的应用程序之前从未发生过这种情况,因此我假设它与此有关。下面是崩溃后的回溯。

我是否有可能在杀死应用程序后没有正确“关闭”我的持久存储? 感谢任何帮助,谢谢。

(gdb) backtrace
#0  0x01700df5 in objc_release ()
#1  0x01701c60 in (anonymous namespace)::AutoreleasePoolPage::pop ()
#2  0x01490ed8 in _CFAutoreleasePoolPop ()
#3  0x00e959f9 in -[NSAutoreleasePool release] ()
#4  0x005a4f78 in _UIApplicationHandleEvent ()
#5  0x02154fa9 in PurpleEventCallback ()
#6  0x015301c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#7  0x01495022 in __CFRunLoopDoSource1 ()
#8  0x0149390a in __CFRunLoopRun ()
#9  0x01492db4 in CFRunLoopRunSpecific ()
#10 0x01492ccb in CFRunLoopRunInMode ()
#11 0x005a12a7 in -[UIApplication _run] ()
#12 0x005a2a9b in UIApplicationMain ()
#13 0x00001f29 in main (argc=1, argv=0xbfffebc4) at main.m:14
#14 0x00001ea5 in start ()

更新
启用僵尸对象和异常日志记录

2012-02-12 14:13:06.162 App[75491:207] *** -[_PFArray release]: message sent to deallocated instance 0x6d71960
(gdb) backtrace
#0  0x014c2ce2 in __forwarding_prep_0___ ()
#1  0x01700e10 in objc_release ()
#2  0x01701c60 in (anonymous namespace)::AutoreleasePoolPage::pop ()
#3  0x01490ed8 in _CFAutoreleasePoolPop ()
#4  0x00e959f9 in -[NSAutoreleasePool release] ()
#5  0x005a4f78 in _UIApplicationHandleEvent ()
#6  0x02154fa9 in PurpleEventCallback ()
#7  0x015301c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#8  0x01495022 in __CFRunLoopDoSource1 ()
#9  0x0149390a in __CFRunLoopRun ()
#10 0x01492db4 in CFRunLoopRunSpecific ()
#11 0x01492ccb in CFRunLoopRunInMode ()
#12 0x005a12a7 in -[UIApplication _run] ()
#13 0x005a2a9b in UIApplicationMain ()
#14 0x00001f29 in main (argc=1, argv=0xbfffeb64) at main.m:14
#15 0x00001ea5 in start ()

I have an app that uses Core Data. I'm able to save and fetch data upon the first time my app builds and runs in the simulator, however, when I close the app, kill it in the simulator, and re-run it, it crashes with EXC_BAD_ACCESS inside of main.

If I uninstall the app on the simulator and run it again, every thing works fine again, until I close the app and open it again when the same thing happens.

This never used to happen before adding Core Data to my app so I'm assuming it has something to do with that. Below is a backtrace after the crash.

Is it possible I'm not properly "closing" my persistent store after killing the app?
Any help is appreciated, Thanks.

(gdb) backtrace
#0  0x01700df5 in objc_release ()
#1  0x01701c60 in (anonymous namespace)::AutoreleasePoolPage::pop ()
#2  0x01490ed8 in _CFAutoreleasePoolPop ()
#3  0x00e959f9 in -[NSAutoreleasePool release] ()
#4  0x005a4f78 in _UIApplicationHandleEvent ()
#5  0x02154fa9 in PurpleEventCallback ()
#6  0x015301c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#7  0x01495022 in __CFRunLoopDoSource1 ()
#8  0x0149390a in __CFRunLoopRun ()
#9  0x01492db4 in CFRunLoopRunSpecific ()
#10 0x01492ccb in CFRunLoopRunInMode ()
#11 0x005a12a7 in -[UIApplication _run] ()
#12 0x005a2a9b in UIApplicationMain ()
#13 0x00001f29 in main (argc=1, argv=0xbfffebc4) at main.m:14
#14 0x00001ea5 in start ()

Update
Enabled Zombie objects and exception logging

2012-02-12 14:13:06.162 App[75491:207] *** -[_PFArray release]: message sent to deallocated instance 0x6d71960
(gdb) backtrace
#0  0x014c2ce2 in __forwarding_prep_0___ ()
#1  0x01700e10 in objc_release ()
#2  0x01701c60 in (anonymous namespace)::AutoreleasePoolPage::pop ()
#3  0x01490ed8 in _CFAutoreleasePoolPop ()
#4  0x00e959f9 in -[NSAutoreleasePool release] ()
#5  0x005a4f78 in _UIApplicationHandleEvent ()
#6  0x02154fa9 in PurpleEventCallback ()
#7  0x015301c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#8  0x01495022 in __CFRunLoopDoSource1 ()
#9  0x0149390a in __CFRunLoopRun ()
#10 0x01492db4 in CFRunLoopRunSpecific ()
#11 0x01492ccb in CFRunLoopRunInMode ()
#12 0x005a12a7 in -[UIApplication _run] ()
#13 0x005a2a9b in UIApplicationMain ()
#14 0x00001f29 in main (argc=1, argv=0xbfffeb64) at main.m:14
#15 0x00001ea5 in start ()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文