Question

I have two entities: Schedule and User. Schedule has a relationship students, which is many to one with User (with an inverse of studentSchedule).

I have all the required Schedule objects in an array called results, but I want to actually get the unique Users from the students relationship.

I am using:

NSLog(@"%@", [results valueForKeyPath:@"students"]);

But I am not getting the correct result as I think due to to Many relation. Does anyone have any idea about this?

Was it helpful?

Solution

You want to use CollectionOperators.

NSLog(@"%@", [results valueForKeyPath:@"@distinctUnionOfObjects.students"]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top