• 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
Re: Sorting a two-dimensional NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting a two-dimensional NSMutableArray


  • Subject: Re: Sorting a two-dimensional NSMutableArray
  • From: Marco Scheurer <email@hidden>
  • Date: Mon, 10 Jun 2002 11:35:06 +0200

On Monday, June 10, 2002, at 08:27 am, Ben O'Neill wrote:
How do I sort a two dimensional array in line, I have been trying with;
records = [records sortedArrayUsingSelector:@selector(compare:)];

where records (the Array is defined as )
records = [[NSMutableArray alloc] initWithContentsOfFile:recordsFile];

but it compiles it returns a warning:
assignment from incompatible pointer type

and when it runs and the above line is run it returns an error:
2002-06-10 16:25:57.624 DVDManager[1272] *** -[NSCFDictionary caseInsensitiveCompare:]: selector not recognized

What am I missing?

It looks like:

1) records is declared as an NSArray.
2) So you should not use [NSMutableArray alloc] but [NSArray alloc].
3) You've got an array of dictionaries, not an array of arrays, check your file contents.
4) You haven't implemented the method -compare: on NSDictionary (nor on NSArray).

But I have to wonder: what does it mean to sort a two-dimensional array?

Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
_______________________________________________
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.

References: 
 >Sorting a two-dimensional NSMutableArray (From: "Ben O'Neill" <email@hidden>)

  • Prev by Date: Re: Network interface active?
  • Next by Date: Re: DoubleClick in a NSTableView
  • Previous by thread: Sorting a two-dimensional NSMutableArray
  • Next by thread: Some NSSplitView questions
  • Index(es):
    • Date
    • Thread