Sorting array : segmentation fault
Sorting array : segmentation fault
- Subject: Sorting array : segmentation fault
- From: "kubernan @ 10191 Tec." <email@hidden>
- Date: Mon, 18 Aug 2003 21:39:22 +0200
Hello,
I tried to sort an array of dictionaries, but it crashes on
segmentation fault.
Can you help me ?
static int _compareKeys(id left, id right, void *ctxt) {
if ([[left objectForKey:(NSString *)ctxt] doubleValue] < [[right
objectForKey:(NSString *)ctxt] doubleValue])
return NSOrderedAscending;
else if ([[left objectForKey:(NSString *)ctxt] doubleValue] >
[[right objectForKey:(NSString *)ctxt] doubleValue])
return NSOrderedDescending;
else
return NSOrderedSame;
}
implentation :
NSMutableArray *sortedArray;
sortedArray = [tempArray sortUsingFunction:_compareKeys
context:attribute];
attribute is the key of the dictionaries from which i want to sort the
referenced object (NSNumber format).
Thx for your help,
K
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.