ios - When I try to remove a UITableViewCell, I get this error: Invalid update: invalid number of rows in section 0, but I can't seem to fix it -


i have gesture on uitableviewcell subclass called articlecell, when swiped method in uitableviewcontroller class gets called delete cell swiped.

the delegate method looks this:

- (void)swipedtoremovecell:(articlecell *)articlecell {     nsindexpath *indexpath = [self.tableview indexpathforcell:articlecell];      [self.tableview beginupdates];     [self.tableview deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationautomatic];     [self.tableview endupdates];      [self.tableview reloaddata]; } 

but every time swipe, error:

invalid update: invalid number of rows in section 0

more information: uses core data data source, uses nsfetchedresultscontroller. have update there? (i haven't touched of methods.)

you need remove row data source object well. need remove core data store @ same time delete row representing data table view itself.

the issue mismatch, remove row table view -numberofrowsintableview data source method still returning old number of rows because fetched results controller still sees number in data store.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -