Domanda

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?

È stato utile?

Soluzione

You want to use CollectionOperators.

NSLog(@"%@", [results valueForKeyPath:@"@distinctUnionOfObjects.students"]);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top