Кузин Дмитрий Кузин Дмитрий - 7 months ago 57
Objective-C Question

Combine two NSFetchedResultsController

Good afternoon! In my project I use

Core Data
, and must be inferred from the two Entity, but I can not figure out how to combine the results of the first and second
one. Must you need in a single table with no separation into sections.


Create an abstract entity, from which both of your entityes inherit.

Also, don't use two NSFetchedResultsController if you're only showing one UITableView, becuase how will you combine the two of them? How will you order it?

Do like this instead:

For example if you want to show Cars and Motorcycles in the the NSFetchedResultsController, you create a class Vehicle and fetch Vehicles instead. Then make sure you set the Parent Entity to Vechicle for both Car and Motorcycle in the coredata-model editor:

enter image description here

EDIT: Here's a answer suggesting the same thing (for fetch requests in general, not specifically NSFetchedResultController Core data: any way to fetch multiple entities?)