I have the following code:
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *golferIconsu = [userDefaults objectForKey:@"golferIconsFirstScene"];
NSMutableDictionary *golferIconsSceneOne = [[NSMutableDictionary alloc]initWithDictionary:golferIconsu];
NSMutableDictionary *savedScoreCards;
NSMutableDictionary *currentScoreCard;
[currentScoreCard setObject:golferIconsSceneOne forKey:@"golferIconsFirstScene"];
NSMutableDictionary *GI = [currentScoreCard objectForKey:@"golferIconsFirstScene"];
[savedScoreCards setObject:currentScoreCard forKey:@"1"];
NSLog([golferIconsSceneOne objectForKey:@"30101"]);
NSLog([GI objectForKey:@"30101"]);
At the end all that is printed out in my log is the first NSLog call, not the second one. For example:
NSLog([golferIconsSceneOne objectForKey:@"30101"]);
This prints out a string that I stored in that dictionary.
This one:
NSLog([GI objectForKey:@"30101"]);
Doesn’t print out anything at all.
How can I get the NSDictionary GI to have the exact same properties as golferIconsSceneOne, but I need to do this using the currentScoreCardDictionary, which contains golferIconsSceneOne?
Initialise your dictionary before setting object in it.