Hallo,
bei meiner aktuellen App nutze ich Core Data und mehrere TableViewController hintereinander. Erste TableView zeigt alle Objekte der Entität A an. Ein A hat mehrere Entitäten B, die im zweiten ViewController angezeigt werden.
Und so geht es mit noch einpaar weiteren Entitäten und TableViews weiter. So eine Art Verwaltung.
Ich habe nun das Problem, dass ich nur die Objekte der ersten TableView löschen kann ohne einen Fehler zu bekommen. Bei allen anderen TableViews/Entities bekomme ich folgenden Fehler:
*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m:1330
*** 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 (1), 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).'
Weiß jemand warum dieser Fehler kommt?
Würde mich über Vorschläge freuen!
Gruß
bei meiner aktuellen App nutze ich Core Data und mehrere TableViewController hintereinander. Erste TableView zeigt alle Objekte der Entität A an. Ein A hat mehrere Entitäten B, die im zweiten ViewController angezeigt werden.
Und so geht es mit noch einpaar weiteren Entitäten und TableViews weiter. So eine Art Verwaltung.
Ich habe nun das Problem, dass ich nur die Objekte der ersten TableView löschen kann ohne einen Fehler zu bekommen. Bei allen anderen TableViews/Entities bekomme ich folgenden Fehler:
*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m:1330
*** 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 (1), 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).'
Weiß jemand warum dieser Fehler kommt?
Quellcode
- - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (editingStyle == UITableViewCellEditingStyleDelete) {
- // Delete the row from the data source
- [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
- }
- else if (editingStyle == UITableViewCellEditingStyleInsert) {
- // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
- }
- }
Würde mich über Vorschläge freuen!
Gruß