0

Getting the following error: CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. no object at index 1 in section at index 0 with userInfo

The scenario is that certain changes to a tableview row requires other rows to be deleted.

It's easily reproduced as follows: 1. fetchedResultsController returns 1 section with 2 rows. tableview displays fine. 2. then do any update to the managed object at index(0,1) and then immediately delete the managed object at index(0,0)

When the frc delegate's didChangeObject method gets called with NSFetchedResultsChangeUpdate, the index is (0,1) - which doesn't exist anymore - and which then causes the error.

Is this a bug - is there a known workaround?

Bob Glass
  • 465
  • 3
  • 12
  • I don't know if this helps, but I had a similar problem once and solved it by handling the "update" notification differently, see http://stackoverflow.com/questions/11432556/nsrangeexception-exception-in-nsfetchedresultschangeupdate-event-of-nsfetchedres. – Martin R Jun 27 '13 at 19:46
  • Thanks Martin R - that was totally the answer to my problem - I didn't notice that the managedobject was one of the arguments to didChangeObject. Can't upvote the answer - I don't have enough reputation points. – Bob Glass Jun 27 '13 at 20:16
  • You are welcome, I am glad that it helped! - (So I am voting to close this as a duplicate.) – Martin R Jun 27 '13 at 20:18

0 Answers0