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 6471939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:17:00+00:00 2026-05-25T06:17:00+00:00

I am having problems reading out a mutable array out of a mutable dictionary.

  • 0

I am having problems reading out a mutable array out of a mutable dictionary. I am trying to read it out, and then put it into a label. Here is how my data is organized. I have a mutable array of dictionaries. Then in my tableview I take the object at index path and set it equal to a dictionary in the app delegate. Then in the details view I load the dictionary that I took out of the array and I read from it and put the values into the labels. I have all the strings in the dictionary working, but the arrays won’t read out, can you help me

RootViewController.m

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    SurveyAppAppDelegate *surveyAppAppDelegate = (SurveyAppAppDelegate*)[[UIApplication sharedApplication] delegate];

    SurveyViewer *surveyViewController = [[SurveyViewer alloc] initWithNibName:@"SurveyViewer" bundle:nil]; 
    surveyAppAppDelegate.arrayCount = [[self surveyArray] objectAtIndex:indexPath.row];


    [self.navigationController pushViewController:surveyViewController animated:YES];
    [surveyViewController release];
}

In my App Delegate it is set as NSDictionary.

Then in my detail view controller I do this

  injuredArray = [surveyAppAppDelegate.arrayCount objectForKey:@"Injured Part"];

    if ([injuredArray count] >= 1) {
        for (int i = 0; i<=([injuredArray count]-1); i++) {
            myLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 105+shift, 139, 15)];
            myLabel.text = [injuredArray objectAtIndex:i];
            myLabel.backgroundColor = [UIColor clearColor];
            myLabel.font = [UIFont fontWithName:@"Helvetica" size: 14.0];
            myLabel.textColor = [UIColor blackColor];
            myLabel.textAlignment = UITextAlignmentLeft;
            [self.theScroller addSubview:myLabel];
            shift = shift+20;
        }
    }

In my App Delegate I set up arrayCount like this

.h

#import <UIKit/UIKit.h>

    @class RootViewController;

    @interface SurveyAppAppDelegate : NSObject <UIApplicationDelegate> {
        NSDictionary *arrayCount;
    }

    @property (nonatomic, assign) NSDictionary *arrayCount;

    @end

and .m

#import "SurveyAppAppDelegate.h"
@implementation SurveyAppAppDelegate
    @synthesize arrayCount;

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {


        arrayCount = [[NSDictionary alloc] init];

Then in the dealloc of the app delegate I release it

Oh, and the objects in the NSMutableArray that I set to injuredArray are all strings

EDIT: So I added a loop to NSLog the array in the root view controller right after I set it, and it isn’t working. So it looks for some reason that it isn’t being saved in arrayCount correctly

Thanks for your help

  • 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-25T06:17:00+00:00Added an answer on May 25, 2026 at 6:17 am

    In your appDelegate header, try retaining the dictionary instead of assigning:

    @property (nonatomic, retain) NSDictionary *arrayCount;
    

    then in implementation:

    NSDictionary *anArrayCount = [[NSDictionary alloc] init];
    self.arrayCount = anArrayCount;
    [anArrayCount release];
    

    Is the injuredArray object you’re assigning already allocated and initialized? That could be the problem…

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

Sidebar

Related Questions

I'm having problems reading this one JPEG file using ImageIO.read(File file) - it throws
I'm having problems redirecting stdio of another program using subprocess module. Just reading from
I am reading XOR linked list (from Wikipedia).But I am having some problems in
Having problems with a small awk script, Im trying to choose the newest of
Im having problems building a query with the linq to sql data query expression
I am having some problems with hibernate and MySQL. I've been reading but I
I am having a hard time figuring out how to write to and read
I'm having some problems reading from a socket. Basically, I can connect to the
I am trying to read a very large file in AS3 and am having
C#.NET 4.0 I'm having an interesting problem here with reading a custom file archive

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.