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

  • Home
  • SEARCH
  • 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 7656121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:41:16+00:00 2026-05-31T12:41:16+00:00

Seems simple enough – I’m creating one master NSMutableDic and filling it with more

  • 0

Seems simple enough – I’m creating one master NSMutableDic and filling it with more of them.

What’s an easy way to access the contents of a dictionary like this?
Although this isn’t Python, perhaps something to the extent of ‘taskDict[4][‘assignedby’]’?

Here’s the code which works fine and dandy:

int counter = 0;

NSArray *cols = [GetProjectInfo getTaskColumns];    
NSArray *rows = [GetProjectInfo fetchAll:projectName];

NSMutableDictionary *taskDict = [NSMutableDictionary dictionary];
NSMutableDictionary *localDict = [NSMutableDictionary dictionary];

for (int x=0; x < rows.count; x++) {

    NSString *rowData = [rows objectAtIndex:x];

    NSString *colData = [cols objectAtIndex:counter];

    //Assign the values colData(key) and rowData(value) into localDict.
    [localDict setValue:rowData forKey:colData];

    counter ++;

    if (counter >= cols.count) {

        counter = 0;

        //Add the whole localDict to the global dictionary (taskDict)
        [taskDict setObject:localDict forKey:localDict];

        //Reset the localDict so that we can populate it with the next set 
        [localDict removeAllObjects];
    }
}

NSLog(@"%@",taskDict);

returns something to the extent of:

            {
    person = "Ryan";
    assignedby = jfreund;
    complete = False;
    timeassigned = "15:35:00";
} =     {
};
    {
    person = "Tim";
    assignedby = klang;
    complete = True;
    timeassigned = "16:59:07";
} =     {
};

Anybody care to throw some ideas this direction?

  • 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-05-31T12:41:18+00:00Added an answer on May 31, 2026 at 12:41 pm

    This doesn’t directly answer your question; but rather than store your object graph as nested dictionaries, could you instead use NSObject subclasses to encapsulate your data so that you don’t have to traverse hierarchies of dictionaries? For example, (mind you, I know nothing about your application’s model layer…) could you break the conceptual model into Project and Task objects, e.g.

    @interface Task : NSObject <NSCoding>
    {
        NSString *_name;
        NSString *_owner;
        NSString *_assignedBy;
        BOOL _complete;
        NSDate *_timeAssigned;
        //  etc.
    }
    

    And then Projects are, in turn, composed of Tasks:

    @interface Project : NSObject <NSCoding>
    {
        NSString *_name;
        NSString *_dateStarted;
        NSMutableArray *_tasks;
        //  etc.
    }
    

    It’s a more object-oriented way of structuring the application’s model layer. There’s nothing about this mechanism that would preclude you from serializing the data to a plist so long as your classes conform to the NSCoding protocol.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seems simple enough. I'm creating a search engine that returns results to the user
Well, it seems simple enough, but I can't find a way to add a
Seems simple enough, but I cannot figure out any way to determine what the
That seems simple enough, but all Django Queries seems to be 'SELECT *' How
Update Solution Found See Bottom of post if interested Seems simple enough and for
this seems like a simple enough question but I can't seem to find a
http://dspace.dial.pipex.com/town/green/gfd34/art/bloopers.html The first one seems simple; return strcpy(malloc(strlen(s)), s); malloc could return null ,
Seems simple enough but I'm having some issues, I tried using preg_replace: preg_replace(<br />,
the documentation seems simple enough, but in practice, this feature is not working! I
Computing a running average of a simple 1-D data vector seems simple enough. Indeed,

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.