I am trying to record how much time my users are staying in a particular skin in my app. I have two mutable dictionaries one that relates my skins' index values to their names and one that relates their names to the time spent viewing them. My problem is that went it goes to increment the time the call to set the new time fails. The first three lines of the code below work fine and then it hit the call to setObject:forKey and it just gets hung up there. The code after it does not get called and it seems to just start the update over.
NSString * str = [IndexToName_ objectForKey:[NSString stringWithFormat:@"%d", game->curSkinIndex]];
NSNumber * skintime = [NameToTime_ objectForKey:str];
NSNumber * nskintime = [NSNumber numberWithFloat:[skintime floatValue] + delta];
[NameToTime_ setObject:nskintime forKey:str];
I use two plist files to initalize the two dictionaries.
IndexToName_ = [[NSMutableDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"IndexToName" ofType:@"plist"]];
NameToTime_ = [[NSMutableDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"NameToTime" ofType:@"plist"]];