Format string for NSPredicate with @avg collection operator
问题 Is there a way to construct an NSPredicate so the following array can be filtered by average score larger than, say, 5? NSArray *objs = @[ @{@"scores":@[@3, @5, @2]}, @{@"scores":@[@5, @2, @8, @9]}, @{@"scores":@[@7, @1, @4]} ]; I have tried various combinations, of which this one seemed the most promising (considering that the key path @avg.self works to obtain the average value of numbers in an array through normal KVC): NSPredicate *pred = [NSPredicate predicateWithFormat:@"scores.@avg