When my app starts, it loops through adding values of random numbers with keys of co-ordinates on a grid to a dictionary. Here is a bit of the code:
[grid setObject:v forKey:k];
K is a string in form "xy" where x and y are single digit integers and V is an NSNumber. Both of these are logged to the console before adding so I know these aren't the problem. However, despite this code running 49 times (for a 7 x 7 grid) the dictionary is empty at the end.
grid is defined in my header file with:
NSMutableDictionary *grid;
And then I initialised it when the app loads (but I don't know if I have to do this) using the code:
grid = [[[NSMutableDictionary alloc] init] retain];
This is really confusing me because I have only just started learning Objective-C and I have come from the far more forgiving universe of C# and Python.
Thanks in advance for the help!