Sorting with sortedArrayUsingDescriptors and Key Paths
问题 I have an unordered array with instances of the following class: @interface Place : NSObject { } @property (nonatomic, copy) NSString *country; @property (nonatomic, copy) NSString *city; @property (nonatomic, retain) NSURL *imageURL; -(id) initWithCountry: (NSString *) aCountry city: (NSString *) aCity imageUrl: (NSURL *) aUrl; @end and I'm trying to sort it with sortedArrayUsingDescriptors by country and city. The docs for NSSortDescriptor say that the arg of initWithKey: is a Key Path.