In my Core Data model, I have an entity Session and Exercise.
Session has a to many relationship to Exercise (there is a one-one inverse relationship as well).
In my fetch, I am trying to find all Session object that are related to the current Exercise.
I am using the following code which isn’t working.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setPredicate:[NSPredicate predicateWithFormat: @"exercise = %@", exercise.name]];
NSEntityDescription *sessionEntity = [NSEntityDescription entityForName:@"Session" inManagedObjectContext:managedObjectContext];
[fetchRequest setEntity:sessionEntity];
NSError *error = nil;
NSArray *results = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
NSLog(@"Fetch error: %@", error);
self.sessionArray = results;
Here is my data model:

First, from the screenshot it seems that your relationship attribute of the Session entity is called
exercisesnotexercise.Also, it seems to me that it would work if you searched not the Session entity but the Exercise entity and then iterate through the resulting array to extract the sessions.
The relationship of the Exercise entity called
exercisescould be calledsessionfor clarity. I would recommend renaming it.BTW, you can also write
=instead of==, they are equivalent, as far as I know. In the Predicate Programming Guide section on Predicate Format String Syntax it says: