Re: Storing objects in NSMutableDictionary
Re: Storing objects in NSMutableDictionary
- Subject: Re: Storing objects in NSMutableDictionary
- From: "email@hidden" <email@hidden>
- Date: Sat, 14 Aug 2010 09:23:30 +0100
On 14 Aug 2010, at 09:08, Geoffrey Holden wrote:
> The class object is 'message' and its key 'messageID' is an NSString. If I set the object to be an NSString (or NSArray or NSDictionary), the dictionary stores it just fine. It just won't store 'message'.
>
Won't store means 'what'? Is an exception raised.
If message or messageID is nil the NSMutableDictionary will raise.
> messageID is, in reality, generated elsewhere. But you could imagine it to be NSString* messageID with a value of, say, @"FirstDocument". Messenger refers to a nib file with which message is initialized. And I know that my method name (initWithApp) might be a bit rubbish, but I can always refactor later!
>
>> NewMessage* message = [[NewMessage alloc] initWithApp:@"Messenger" :self];
>> [currentMessages setObject:message forKey:messageID];
>
Message isn't a class object, it's an instance of the NewMessage class.
Plus the method signature looks wonky.
Post the code for NewMessage initWithApp: if you are still having problems.
Regards
Jonathan Mitchell
Developer
Mugginsoft LLP
http://www.mugginsoft.com_______________________________________________
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