Simple NSMutableDictionary problem
Simple NSMutableDictionary problem
- Subject: Simple NSMutableDictionary problem
- From: Matt Keyes <email@hidden>
- Date: Tue, 12 Aug 2008 21:12:00 +0000
- Importance: Normal
How do I have an int as a value in a NSMutableDictionary object?
for example:
NSMutableDictionary *myDictionary = [NSMutableDictionary alloc];
int i = 1;
[myDictionary setValue:1 forKey:@"One"];
This causes a compiler warning:
"warning: passing argument 1 of 'setValue:forKey:' makes pointer from integer without a cast"
It seems like (b/c the type is "id" for the first param) that NSMutableDictionary wants a pointer. Well, how do I give it just a plain integer copy without having the compiler yell at me? I have been banging my head on my desk over this silly little thing.
Also, how do I define a non-mutable dictionary of a particular size? There is no dictionaryWithCapacity function that I can find in the non-mutable version. All the examples I can find are not practical (i.e. hardcoding a dictionary at its creation with random values like @"One", @"Two", etc.).
Thanks!
Matt
_________________________________________________________________
Reveal your inner athlete and share it with friends on Windows Live.
http://revealyourinnerathlete.windowslive.com?locale=en-us&ocid=TXT_TAGLM_WLYIA_whichathlete_us_______________________________________________
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