If you want to get data from dictionary and add them into an array below code will help you, In this blog firstly i have created a NSMutableAarray and after that created a NSArray which contain the value like ram,13 etc then i created a NSMutableDictionary which create a key for array after that i have added all the data from dictionary into a mainArray and display all the data.
NSMutableArray *mainArray = [NSMutableArray array];
NSArray *array1 = [NSArray arrayWithObjects:@"Ram",
[NSNumber numberWithInteger:13],
[NSArray arrayWithObjects:@"Kumar",@"Singal",nil],
nil];
NSLog(@"The array contain the following element %@",array1);
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:array1 forKey:@"data"];
NSLog(@"the dictionary is %@",dict);
[mainArray addObjectsFromArray:[dict objectForKey:@"data"]];
NSLog(@"main array is %@",mainArray);
0 Comment(s)