How to get the largest value from NSArray containing dictionaries?

Viewed 5835

How do you get the largest value from an NSArray with dictionaries?

Lets say I have NSArray containing dictionaries with keys "age", "name", etc. Now I want to get the record with the highest age. Is this possible with some KVC magic? Or do I have to iterate through and do it the "manual" way?

I've tried with something similar to this:

int max = [[numbers valueForKeyPath:@"@max.intValue"] intValue];
2 Answers
Related