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

Storing objects in NSMutableDictionary


  • Subject: Storing objects in NSMutableDictionary
  • From: Geoffrey Holden <email@hidden>
  • Date: Fri, 13 Aug 2010 21:09:40 +0100

Is it possible to store a class object in NSMutableDictionary?  I want to do something like the following - but it doesn't seem to work!

NewMessage* message = [[NewMessage alloc] initWithApp:@"Messenger" :self]; //initWithApp passes in the nib name and a reference to itself (wonder where I got that clever idea from!)
[currentMessages setObject:message forKey:messageID];


Trouble is, this doesn't seem to work - currentMessages (an NSMutableDictionary) seems to be able to store anything except a class object.

On the other hand, when I tried this with NSMutableArray it worked - except that I couldn't store the messageID as part of the item, which is kind of important.  An NSMutableDictionary would be perfect - any ideas how I can achieve this!?

Regards,

Geoff_______________________________________________

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: Storing objects in NSMutableDictionary
      • From: Greg Parker <email@hidden>
    • Re: Storing objects in NSMutableDictionary
      • From: Brian Postow <email@hidden>
    • Re: Storing objects in NSMutableDictionary
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: MOC Migrations Using .xcdatamodeld
  • Next by Date: Re: Storing objects in NSMutableDictionary
  • Previous by thread: Re: MOC Migrations Using .xcdatamodeld
  • Next by thread: Re: Storing objects in NSMutableDictionary
  • Index(es):
    • Date
    • Thread