How to creat a FetchedResultsController? #265

Open
opened 2025-12-29 15:27:53 +01:00 by adam · 2 comments
Owner

Originally created by @jshl8612 on GitHub (Apr 16, 2019).

Would you like to tell me the right way to make a FetchedResultsController?

let fecthController = dataStack.createFetchedResultsController(From<Food>(), SectionBy<Food>("name"), OrderBy<Food>(.ascending("foodID")))

With above code, fetchedObjects is always nil.

Originally created by @jshl8612 on GitHub (Apr 16, 2019). Would you like to tell me the right way to make a FetchedResultsController? `let fecthController = dataStack.createFetchedResultsController(From<Food>(), SectionBy<Food>("name"), OrderBy<Food>(.ascending("foodID")))` With above code, fetchedObjects is always nil.
adam added the question label 2025-12-29 15:27:53 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Apr 16, 2019):

Is there any reason you prefer NSFetchedResultsController instead of ListMonitor?

As for your question, there's nothing that looks wrong in your code so there must be some other problem. Are you seeing any error logs in the console?

@JohnEstropia commented on GitHub (Apr 16, 2019): Is there any reason you prefer `NSFetchedResultsController` instead of `ListMonitor`? As for your question, there's nothing that looks wrong in your code so there must be some other problem. Are you seeing any error logs in the console?
Author
Owner

@jshl8612 commented on GitHub (Apr 17, 2019):

Is there any reason you prefer NSFetchedResultsController instead of ListMonitor?

As for your question, there's nothing that looks wrong in your code so there must be some other problem. Are you seeing any error logs in the console?

Because the ListMonitor<Food> couldn't set to ListMonitor<SuperClassOfFood>.

I have a BaseViewController contains NSFetchedResultsController to deal with most of the same job, and overriding the get function in subclass.

There was no error logs in console.

@jshl8612 commented on GitHub (Apr 17, 2019): > Is there any reason you prefer `NSFetchedResultsController` instead of `ListMonitor`? > > As for your question, there's nothing that looks wrong in your code so there must be some other problem. Are you seeing any error logs in the console? Because the `ListMonitor<Food>` couldn't set to `ListMonitor<SuperClassOfFood>`. I have a `BaseViewController` contains `NSFetchedResultsController` to deal with most of the same job, and overriding the get function in subclass. There was no error logs in console.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#265