• 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: Storing objects in NSMutableDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing objects in NSMutableDictionary


  • Subject: Re: Storing objects in NSMutableDictionary
  • From: Michael Ash <email@hidden>
  • Date: Fri, 13 Aug 2010 18:42:57 -0400

On Fri, Aug 13, 2010 at 4:22 PM, Greg Parker <email@hidden> wrote:
> On Aug 13, 2010, at 1:09 PM, Geoffrey Holden wrote:
>> Is it possible to store a class object in NSMutableDictionary?
>
> Class objects cannot be used as dictionary keys, because NSDictionary copies its keys and class objects can't be copied. Class objects can be used as dictionary values.

This does not appear to be the case. From the NSObject docs:

copyWithZone:
Returns the receiver.

+ (id)copyWithZone:(NSZone *)zone

Return Value
The receiver.

Discussion
This method exists so class objects can be used in situations where
you need an object that conforms to the NSCopying protocol. For
example, this method lets you use a class object as a key to an
NSDictionary object. You should not override this method.

Mike
_______________________________________________

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

References: 
 >Storing objects in NSMutableDictionary (From: Geoffrey Holden <email@hidden>)
 >Re: Storing objects in NSMutableDictionary (From: Greg Parker <email@hidden>)

  • Prev by Date: Re: Using NSPredicateEditor with core data
  • Next by Date: NSOutlineView Drop
  • Previous by thread: Re: Storing objects in NSMutableDictionary
  • Next by thread: Re: Storing objects in NSMutableDictionary
  • Index(es):
    • Date
    • Thread