views:

124

answers:

1

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  A: 

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:

http://www.devworld.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdTroubleshooting.html

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

Mike Weller