coredata error because sectionNameKeyPath or grouping data at NSFetchedResultsController

拥有回忆 提交于 2019-12-05 17:33:46

I figured the answer out. If you group by building you must also sort by building or building location. The order of your sorting must match the order of your grouping. So you cannot have a situation where items on the same "group" to have separate ordering.

The first thing you should do is to rename your relationships and attributes. I don't know how but usually attribute names and relationship names cannot start with a big letter. Usually the model editor in Xcode enforces this.

Now to your actual problem:

There are, as always, more than one solution. I try to explain one possible solution:

Make sure that Building.Title is never nil: You can do this in your controller layer or in your model layer. If you do it in the model layer simply create a subclass of NSManagedObject for this entity and create a new readonly property that you may call "titleForDisplay". Before returning the value of Title simply check if its nil and if so replace it with a localized string that represents nil values.

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