FROM : David Alter
DATE : Tue Jun 13 21:01:01 2006
I'm using sortedArrayUsingFunction to sort an array of NSDictionaries
on a specific item in the dictionary. It is giving me an error of
"selector not recognized". I thought that was the point of using a
function, that way I was not dependant on a selector in the class.
here is what I have
@implementation MyClass
...
static int orderByName(id item1, id item2, void *context) {
//The item name is a NSString in the dictionary
return [[item1 objectForKey:@"name"] compare: [item2
objectForKey:@"name"]];
}
-(void) someMethedThatCallsTheSort
{
...
NSArray * sortedItems = [unsortedItems
sortedArrayUsingFunction:orderByName context:nil];
...
}
...
@end
Can someone please let me know what I'm missing here.
Thanks for the help
-dave
DATE : Tue Jun 13 21:01:01 2006
I'm using sortedArrayUsingFunction to sort an array of NSDictionaries
on a specific item in the dictionary. It is giving me an error of
"selector not recognized". I thought that was the point of using a
function, that way I was not dependant on a selector in the class.
here is what I have
@implementation MyClass
...
static int orderByName(id item1, id item2, void *context) {
//The item name is a NSString in the dictionary
return [[item1 objectForKey:@"name"] compare: [item2
objectForKey:@"name"]];
}
-(void) someMethedThatCallsTheSort
{
...
NSArray * sortedItems = [unsortedItems
sortedArrayUsingFunction:orderByName context:nil];
...
}
...
@end
Can someone please let me know what I'm missing here.
Thanks for the help
-dave
| Related mails | Author | Date |
|---|---|---|
| David Alter | Jun 13, 21:01 | |
| Fritz Anderson | Jun 13, 23:16 | |
| David Alter | Jun 13, 23:31 | |
| glenn andreas | Jun 13, 23:47 | |
| Fritz Anderson | Jun 13, 23:47 |






Cocoa mail archive

