I am an Obj-C newbie so this might be an obvious question.
I am adding 10 numbers as keys to an NSMutableDictionary with value 0 for all of them. Something like this --
for( i=1; i<10; i++)
{
[dict setObject:[NSNumber numberWithInt:0] forKey:[NSNumber numberWithInt:i]];
}
Now at a later point in code I want to get the object stored for the key number and obtain its value. In this case for e.g. for number 3 as key we stored the value 0. For this I use this code -
id numberObj = [game objectForKey:[NSNumber numberWithInt:3]];
int numberObjValue = ????
I see id in the debugger as pointing to 0. But I am not sure how to get it into an integer variable I declared. Hope that makes sense.
I print numberObj and some address is printed as expected. How do I turn this generic id into a NSNumber and subsequently store it in numberObjValue?