iPhone 开发 - CoreData 运行时错误
我面临一个奇怪的 CoreData 问题。日志如下:
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.'
我有一个 UITableViewController 层次结构,它使用 NSFetchedResultsController 来填充表,并且当选择特定行时,会显示详细信息视图。
UITableView (MyMainEntity)
UITableView (MyEntity)
UITableView (MyEntity) detail view
MyMainEntity UITableView 和 MyEntity UITableView 都使用 NSFetchedResultsController 来显示记录。有时当我滚动 tableView 时它会崩溃,有时当我尝试打开详细视图时它会崩溃。在应用程序崩溃之前,我可以多次导航到 MyEntity 详细信息视图。
这个错误是什么意思?我该如何解决它!?
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!?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果对象已失效,通常意味着底层托管对象模型已被释放。您需要确保保留包含您正在处理的对象的托管对象模型。
有关更多详细信息,请参阅此页面:
https://developer .apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/TroubleshootingCoreData.html
这也可能意味着 MOC 已被重置,或者底层存储文件现已消失。
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.