NSFetchedResultsController doesn't see new inserts / removes fetched values after update

蓝咒 提交于 2019-12-03 13:15:46
Jody Hagins

Actually, I think your first pre-edit posting had all the necessary information. I just did not read it (I don't like having to keep scrolling right read long lines of code and sometimes just don't do it - my bad).

Your issue seems to be related to your FRC sort descriptors.

FRC does not deal well with keeping relationship sort descriptors updated very well.

Some have argued that it is how it's designed. I argue it is a bug.

See this post Changing a managed object property doesn't trigger NSFetchedResultsController to update the table view for my take. Hopefully, you will see the similarities to your case.

I just spent time with the same issue and found out the following: when the sectionNameKeyPath was referring to a relationship field that could take the nil value, the FRC update would not work when inserting objects.

This may be related to a warning in Xcode console saying that the section would be created for objects with that field set to nil. I guess that section messes up with the FRC inner-working.

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