Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8103725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:38:04+00:00 2026-06-05T23:38:04+00:00

So I have a dictionary in a dictionary with arrays. I am trying to

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:38:06+00:00Added an answer on June 5, 2026 at 11:38 pm

    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:

        NSMutableDictionary *mealInfo = [[NSMutableDictionary alloc] init];
    
        NSMutableDictionary *breakfast = [[NSMutableDictionary alloc] init];
        [breakfast setObject:[[NSMutableArray alloc] init] forKey:@"name"];
        [breakfast setObject:[[NSMutableArray alloc] init] forKey:@"detail"];
        [breakfast setObject:[[NSMutableArray alloc] init] forKey:@"ndb"];
        [breakfast setObject:[[NSMutableArray alloc] init] forKey:@"id"];
        [breakfast setObject:[[NSMutableArray alloc] init] forKey:@"alias"];
    
        [mealInfo setObject:breakfast forKey:@"breakfast"];
    

    Then try breaking it down a bit when you try to enter information and wrap it in a function

    -(void) addMealName:(NSString*) name forMeal:(NSString*) meal 
    {
        NSMutableDictionary *meals = [mealInfo objectForKey:meal];
        NSMutableArray *mealNames = [breakfast objectForKey:@"name"];
        [mealNames addObject:name];
        [meals setObject:breakfastNames forKey:@"name"];
        [mealInfo breakfast forKey:meal];
    }
    

    And call

    NSString *newMealName = [food_prop objectForKey:@"description"];
    [initMealInfo addMealName:newMealName forMeal:@"breakfast"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build an array that contains arrays of dictionary objects in
I am trying to implemen Add to Favorites functionality using NSMutableDictionary as I have
I have two array with string values, and one dictionary, im trying to add
Have Dictionary <Int64, byte> that gets used a lot. I mean in a loop
I have a dictionary of objects; they are all POCO objects that should be
I have a dictionary of strings that i want the user to be able
I have a method that I want to pass in a couple of arrays
I'm trying to create a filter. I have a function that returns an NSArray
I have a list string tag. I am trying to initialize a dictionary with
I seem to have an odd problem while trying to add objects to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.