Getting and setting NSArrays in an NSMutableDictionary

25 Views Asked by At

I have a global file that stores values before another class is deallocated that created the values. My method looks like this for storing:

`- (void)set_plantKind:(NSArray *)plantKindArr forMapName:(NSString *)mapName { [plantKinds setObject:plantKindArr forKey:mapName];

NSLog(@"key: %@, value: %@", mapName, [plantKinds objectForKey:mapName]);

} `

I can log plantKindArr and mapName just fine, but it does not seem to storing plantKindArr in the dictionary, or maybe I just don't know how to retrieve it correctly. I tried logging as you can see in the NSLog, yet the value returns null. Any clues to what I could be doing wrong here?

1

There are 1 best solutions below

0
Chewie The Chorkie On

I never allocated it. Oops!

plantKinds = [[NSMutableDictionary alloc] init];

It's monday, time to wake up.