I am using a table view which is being populated by a NSFetchedResultsController. The table show lists. The lists entity has one to many relationship with tasks. Then there is a note entity which has one to one relationship with tasks. After introducing the note entity and relationship with tasks, I am getting this assertion error
error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out). with userInfo (null) CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out). with userInfo (null) 2018-09-02 12:41:37.856931+0500 List24[26505:860491] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).' * First throw call stack:
This error never occurred before. However, it is really rarely. Occurred just twice but I have no idea what is causing it.
The notes have one to one relation with tasks. And the deletion is cascading between lists and tasks. So if I delete lists it should delete tasks and that should delete the notes as well.
Any suggestions or tips I can do to try fix it once and for all. Thanks!