iPhone Development - CoreData runtime error

て烟熏妆下的殇ゞ 提交于 2019-12-24 11:37:09

问题


I'm facing a strange CoreData issue. Here's the log:

2010-04-07 15:59:36.913 MyProject[263:207] <MyEntity: 0x180370> (entity: MyEntity; id: 0x17e890 <x-coredata://0F55C533-41BD-4F09-9CCA-0CB304CAB065/MyEntity/p380> ; data: <fault>)
2010-04-07 15:59:36.918 MyProject[263:207] *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'The NSManagedObject with ID:0x17e890 <x-coredata://0F55C533-41BD-4F09-9CCA-0CB304CAB065/MyEntity/p380> has been invalidated.'

I have a hierarchy of UITableViewControllers that use NSFetchedResultsController to populate the table, and when a particular row is selected, the detail view is shown.

UITableView (MyMainEntity)
UITableView (MyEntity)
UITableView (MyEntity) detail view

Both MyMainEntity UITableView and MyEntity UITableView use NSFetchedResultsController to show the records. Sometimes it crashes when i'm scrolling the tableView, and sometimes it crashes when i try to open the detail view. I can navigate to the MyEntity detail view multiple times before application crashes.

What does this error mean? and how can i fix it!?


回答1:


If the object has been invalidated it usually means the underlying managed object model has been released. You need to make sure you retain the managed object model that contains the objects you are dealing with.

See this page for more details:

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/TroubleshootingCoreData.html

It could also mean the MOC has been reset, or the underlying store file is now gone.



来源:https://stackoverflow.com/questions/2592333/iphone-development-coredata-runtime-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!