(私のカスタム)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