• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Sorting array : segmentation fault
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Sorting array : segmentation fault
      • From: Chris Hanson <email@hidden>
    • Re: Sorting array : segmentation fault
      • From: Ben Dougall <email@hidden>
  • Prev by Date: Re: Front-to-back ordering in IB changes
  • Next by Date: Distributed Addressbook entries...
  • Previous by thread: Get notified when the frontmost app changes
  • Next by thread: Re: Sorting array : segmentation fault
  • Index(es):
    • Date
    • Thread