I have been scouring Apple's Predicate Programming Guide and SO as well, trying to determine the correct way to write a predicate for a certain fetch request.
It seems like the way I am attempting to use dot notation to traverse a relationship is not being respected by the request.
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Task" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"project.user == %@", self.user];
[fetchRequest setPredicate:predicate];
User, Project, and Task are all core data entities mapping to a BaaS provider (StackMob).
Relationships are as follows: User one-to-many Project one-to-many Task with inverse relationships as you would expect. What I am trying to do is get all tasks for the current logged in user. So, my thinking is: send a fetch request with the entity "Task". Where the project that owns the task is owned by the logged in user, get that task and display it. Simple enough.
And I think I should be able to use the dot notation in the predicate that I have shown above, but the fetch request is returning nil.
Everything else about the fetch request is fine. If I change the format string to @"project != NULL"
, I get all of the tasks back.
Am I just writing my format string incorrectly? Is dot notation somehow not valid when sending a fetch request to StackMob?
As always, any help is greatly appreciated.
Please let me know if more information is needed. I'm a little too close to this right now to see it clearly.