NSFetchedResultsController custom sort not getting called

后端 未结 3 1664
长情又很酷
长情又很酷 2020-12-05 21:08

I am currently trying to populate a UITableView in my project from Core Data using NSFetchedResultsController. I am using a custom search with a comparator (although I have

3条回答
  •  [愿得一人]
    2020-12-05 21:39

    There are a couple of things I can think of. First, though this may not be your problem, you cannot sort on transient properties. But more likely is that when sorting in a model backed by a SQL store, the comparator gets "compiled" to a SQL query, and not all Objective-C functions are available. In this case, you'd need to sort in memory after the fetch is performed.

    EDIT: See this doc, specifically the Fetch Predicates and Sort Descriptors section.

提交回复
热议问题