UITableView not updating DataSource after change to NSFetchedResultsController

送分小仙女□ 提交于 2019-12-05 11:41:21

It's possible that the old controller is still alive. If so, it might still be calling the tableview controller as its delegate and activating the table update using it's own data.

I would suggest logging the fetched results controller object in numberOfRowsInSection to confirm that it using the new controller. You should set the old controller's delegate to nil before assigning the new one.

On one occasion, adding:

- (void)viewDidDisappear:(BOOL)animated
{     
 self.fetchedResultsController.delegate = nil;
}

Solved a similar issue which arises when number of rows changes but data held is still different and not up-to-date.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!