• 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: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects


  • Subject: Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Fri, 06 Jun 2008 14:16:23 -0700

On Friday, June 06, 2008, at 02:07PM, "George Stuart" <email@hidden> wrote:

>The suggestion of using a keyPath of @"self" presents another question:
>1)  I assume NSSortDescriptor is using valueForKeyPath:, which in
>turns calls valueForKey: some number of times, to get the object for
>the keyPath I specified.  Is it defined behavior that sending an
>object valueForKey:@"self" will return the object itself?

I always use self as the key path in cases like this, since -[NSObject self] is documented to return the receiver.  It has the advantage of working with objects other than strings.

> I guess
>this is ultimately the same as my original question, "is it defined
>behavior that sending an object valueForKey:nil will return the object
>itself?"

Not as far as I know; I'd expect it to return nil or die with an assertion failure.

--
Adam
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects
      • From: Ken Thomases <email@hidden>
References: 
 >Using NSSortDescriptor to reverse sort an NSArray containing NSString objects (From: George Stuart <email@hidden>)
 >Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects (From: Ken Thomases <email@hidden>)
 >Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects (From: Andrew Merenbach <email@hidden>)
 >Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects (From: George Stuart <email@hidden>)

  • Prev by Date: Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects
  • Next by Date: Re: Regular Expressions?
  • Previous by thread: Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects
  • Next by thread: Re: Using NSSortDescriptor to reverse sort an NSArray containing NSString objects
  • Index(es):
    • Date
    • Thread