What do you think about just fetching the Departements and then use a key path for the sort descriptor. I try coding this up:
NSFetchRequest *allDepartements = [[NSFetchRequest alloc] init];
[allDepartements setEntity:[NSEntityDescription entityForName:@"departements"
inManagedObjectContext:moc]];
// now specify the sorting
NSSortDescriptor *sortDesc = [[NSSortDescriptor alloc] initWithKey:@"departementNews.date"] ascending:YES];
[allDepartements setSortDescriptors:[NSArray arrayWithObject:sortDesc]];
[sortDesc release];
// performing the fetch without an NSFetchedResultsController
NSError *error = nil;
NSArray *result = [moc executeFetchRequest:allDepartements error:&error];
[allDepartements release];
What you get is an array of Departements sorted by the most recent news entry. You can then simply get to the news by using KVC.
To use now the NSFetchedResultsController, you simply replace the lase block where the fetch is executed and saved into an array by this block of code:
NSFetchedResultsController *controller = [[NSFetchedResultsController alloc]
initWithFetchRequest:allDepartements
managedObjectContext:moc
sectionNameKeyPath:nil
cacheName:@"<#Cache name#>"];
[allDepartementsRelease];
The rest should then work as expected. I have never user NSFetchedResultsController before, I used to code it manually on the mac.