I have an app using tableview and NSFetchedResultsController. I am getting the error:
Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no object at index 1 in section at index 0'
... from the code below. selectedevents
is an array whose count is equal to that of objects in fetched results controller.
NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
NSMutableArray *array=[[NSMutableArray alloc] init];
for (int i=0; i<[self.selectedEvents count]; i++) {
CustomDictionary *dic=[selectedEvents objectAtIndex:i];
if (dic.isSelected) {
Event *evt=[fetchedResultsController objectAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
[array addObject:evt];
}
}
for (Event *evt in array) {
[context deleteObject:evt];
}
NSError *error;
if (![context save:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}