Frage

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?

War es hilfreich?

Lösung

You want to use CollectionOperators.

NSLog(@"%@", [results valueForKeyPath:@"@distinctUnionOfObjects.students"]);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top