1

我正面临一个奇怪的 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.'

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

MyMainEntity UITableView 和 MyEntity UITableView 都使用 NSFetchedResultsController 来显示记录。有时它在我滚动 tableView 时崩溃,有时它在我尝试打开详细视图时崩溃。在应用程序崩溃之前,我可以多次导航到 MyEntity 详细信息视图。

这个错误是什么意思?我该如何解决它!?

4

1 回答 1

1

如果对象已失效,通常意味着底层托管对象模型已被释放。您需要确保保留包含您正在处理的对象的托管对象模型。

有关详细信息,请参阅此页面:

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

这也可能意味着 MOC 已被重置,或者底层存储文件现已消失。

于 2010-05-09T06:31:12.757 回答