I have created 5 NSDictionary's. I stored them in NSArray. I need to get the values stored in NSDictionaries. How can do it ?
I tried calling [[array objectAtIndex:i]objectForKey:key1]
.
But, it is crashing by giving the message:unrecognized selector sent to instance
How to get the data ?
NSDictionary *enemy1, *enemy2;
NSArray *enemyData;
-(void)viewDidLoad
{
enemy1 = [NSDictionary dictionaryWithObjectsAndKeys:@"3", @"Countdown speed", @"3", @"Enemy gun draw", @"1", @"Enemy gun fire", @"0.8", @"Enemy hit probability", @"1", @"Enemy re-fire interval", nil];
enemy2 = [NSDictionary dictionaryWithObjectsAndKeys:@"3", @"Countdown speed", @"2.8", @"Enemy gun draw", @"0.9", @"Enemy gun fire", @"0.8", @"Enemy hit probability", @"0.9", @"Enemy re-fire interval", nil];
enemyData = [NSArray arrayWithObjects:@"enemy1", @"enemy2", nil];
NSLog(@"Value in Array: %f", [ [enemyData objectAtIndex:1]objectForKey:@"Enemy gun draw"] );
}