(私のカスタム)GTPersonオブジェクトを含むNSDictionaryがあります。GTPersonには、NSMutableSet *parents私が使用する属性とが@propertyあり@synthesizeます。
NSDictionaryから、親を持たない、つまり親の数が0であるすべてのGTPersonオブジェクトをフィルタリングしたいと思います。
私は次のコードを使用しています:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"parents.count = 0"];
NSArray *np = [[people allValues] filteredArrayUsingPredicate:predicate];
これを実行すると、次のエラーが発生します。
[<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.'
属性countではなくGTPersonを呼び出そうとしているのはなぜですか?parents