I have a very odd error with Core Data
. I have a Recipe
class that has a many to many relationship to an Ingredient
class.
When I try to add an Ingredient
to the Recipe
on a RecipeViewController
, everything works fine until I save the context. Thats when things go horribly wrong.
I get an error on my RecipesTableViewController
(which has a NSFetchedResultsController
and implements NSFetchedResultsControllerDelegate
). The
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
method gets called and then I get an exception:
CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. -[KCGIngredient sectionOffset]: unrecognized selector sent to instance 0x7bf83d50 with userInfo (null)
I have no idea what this sectionOffset
message is and couldn't find it in the documentation. This happens after NSFetchResultsController
gets the _postprocessInsertedObjects:
message.
I'm assuming this sectionOffset
message was intended to an instance of NSFetchedResultsController
, but I have no idea how it ended up being sent to a model object.
EDIT:
Actually, I checked it out and apparently sectionOffset
is not a method of NSFetchedResultsController
.
This test fails miserably:
XCTAssertTrue([NSFetchedResultsController instancesRespondToSelector:@selector(sectionOffset)]);
What on Earth is going on? I already tried everything,s o if you can shed some light, I'd really appreciate it.