Ich habe eine NSDictionary die (meine benutzerdefinierte) GTPerson Objekte enthält. GTPerson hat ein NSMutableSet *parents
Attribut, auf das ich @property
und @synthesize
verwenden.Mit Schlüsselpfade in NSPredicates
Aus meinem NSDictionary, ich will alle GTPerson Objekte filtern, die haben keine Eltern, also dort, wo die Anzahl der Eltern ist 0.
ich den folgenden Code bin mit:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"parents.count = 0"];
NSArray *np = [[people allValues] filteredArrayUsingPredicate:predicate];
Wenn ich dies ausführen, erhalte ich folgende Fehlermeldung:
[<GTPerson 0x18e300> valueForUndefinedKey:]: this class is not key value coding-compliant for the key count.
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GTPerson 0x18e300> valueForUndefinedKey:]: this class is not key value coding-compliant for the key count.'
Warum ist es versuchen count
auf GTPerson rufen und nicht auf seine parents
Attri Bute?