I need to sort an array of dictionaries based on a given key. I tried the follow line of code:
set sortedTeams to theTeamsArray's sortedArrayUsingDescriptors_(theTeamsArray's initWithKey_Ascending_("rating", true))
and got the following errors:
2012-09-01 09:56:52.963 NFL Spreads Generator[12813:1307] -[__NSArrayM initWithKey:Ascending:]: unrecognized selector sent to instance 0x40012a8a0
2012-09-01 09:56:52.972 NFL Spreads Generator[12813:1307] *** -[NFL_Spreads_GeneratorAppDelegate generateTeamRatings:]: -[__NSArrayM initWithKey:Ascending:]: unrecognized selector sent to instance 0x40012a8a0 (error -10000)
“rating” is one of the keys in the dictionaries within theTeamsArray. The “init” in initWithKey:Ascending: is most likely a clue and I’m not sure how to follow it.
Hopefully I’m on the right path and just misstepped somewhere along the way.
Thanks in advance,
Brad