So I have a dictionary in a dictionary with arrays. I am trying to add to the arrays that are in the second dictionary.
[mealInfo setObject:[[NSMutableDictionary alloc]init] forKey:@"breakfast"];
[[mealInfo objectForKey:@"breakfast"] setObject:[[NSMutableArray alloc] init] forKey:@"name"];
[[mealInfo objectForKey:@"breakfast"] setObject:[[NSMutableArray alloc] init] forKey:@"detail"];
[[mealInfo objectForKey:@"breakfast"] setObject:[[NSMutableArray alloc] init] forKey:@"ndb"];
[[mealInfo objectForKey:@"breakfast"] setObject:[[NSMutableArray alloc] init] forKey:@"id"];
[[mealInfo objectForKey:@"breakfast"] setObject:[[NSMutableArray alloc] init] forKey:@"alias"];
The creation seems to be working just the adding multiple elements to the arrays is where I end up with a SIGABRT error
I add like such
[[[initMealInfo->mealInfo objectForKey:@"breakfast"] objectForKey:@"name"] addObject:[food_prop objectForKey:@"description"]];
I know I am doing something wrong and would like to figure out what any help would be greatly appreciated.
Firstly, are you using ARC? Else you have a lot of trouble.
You should read up on the Principle of Least Knowledge and the Law Of Demeter
Is making the structure like this more intuitive:
Then try breaking it down a bit when you try to enter information and wrap it in a function
And call