• 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: objectForKey:self
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objectForKey:self


  • Subject: Re: objectForKey:self
  • From: Jonathan del Strother <email@hidden>
  • Date: Mon, 26 Jun 2006 16:52:28 +0100

On 26 Jun 2006, at 16:39, Nick Zitzmann wrote:


On Jun 26, 2006, at 6:05 AM, Jonathan del Strother wrote:

The instance variables are then looked up by using the instance pointer as the key. Here's the strange part - I was using objectForKey:self, and it worked fine on my Powerbook, but seemed to break everywhere else. Replacing that with objectForKey: [NSNumber numberWithInt:self] seems to work fine, regardless of the environment.

Can anyone explain why objectForKey:self works in some places but not others?

Does the "self" class support NSCopying? You can't use objects as keys in dictionaries if the objects don't support NSCopying.


True, and no - NSWindow/BrowserWindow don't support NSCopying. Which explains why it's likely to break when I use objectForKey:self.... it just doesn't explain why it worked flawlessly on my Powerbook. Odd...


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >objectForKey:self (From: Jonathan del Strother <email@hidden>)
 >Re: objectForKey:self (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Implementing Undo for a Cut operation, against an NSManagedObject
  • Next by Date: Eject Key Code
  • Previous by thread: Re: objectForKey:self
  • Next by thread: Displaying the contextual menu in the fullscreen window
  • Index(es):
    • Date
    • Thread