Search code examples
cocoa-touchios5nsfetchrequest

NSFetchedResultsController add Objects manually


I recently stumbled across a difficult problem..

I'm normally using a NSFetchedResultsController to get Data out of my CoreData, and display it within a TableViewController.

The problem I have now is that I can't get the results I want with a NSFetchRequest right away, because having a m:n relationship and I implemented a Table in Core Data (References) which stores the references to the Objects...

So what I do now is, I use a fetch Request:

NSArray* references = [self.context executeFetchRequest:fetchRequest error:&error];

and then iterate through this array to get my Objects:

for(References* ref in references)
{
    Post* tmp = ref.ref_of_post;
}

So is there a way to manually add these objects to my NSFetchedResultsController or is there a possibility to get the wanted object trough a NSFetchRequest?

Thanks for your help.


Solution

  • Never mind that.

    I just added these Objects to a NSMutableArray and then would use this Array in the same way as the NSFetchedResultsController..