Re: Storing objects in NSMutableDictionary
Re: Storing objects in NSMutableDictionary
- Subject: Re: Storing objects in NSMutableDictionary
- From: Greg Parker <email@hidden>
- Date: Fri, 13 Aug 2010 13:22:34 -0700
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.
> [currentMessages setObject:message forKey:messageID];
Is `messageID` supposed to be the class object? If so, that won't work. One solution is to use NSString class names for the dictionary keys, and use NSClassFromString() and NSStringFromClass() to convert.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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