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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:43:16+00:00 2026-05-15T20:43:16+00:00

This method doesn’t work…but when I move away from returning a dictionary object and

  • 0

This method doesn’t work…but when I move away from returning a dictionary object and return a single array to the table data source, it works perfectly. so the error of my ways is in how i am creating this dictionary…

Any Help?

- (NSDictionary *) returnDictionary {
self.shopNameArray = [[NSArray alloc] arrayWithObjects: @"Item 1", @"Item 2", @"Item 3", nil];
self.shopLocationArray = [[NSArray alloc] arrayWithObjects: @"Cincinnati, OH", @"Phoenix, AZ", @"Tuscon, AZ", nil];
self.shopImageArray = [[NSArray alloc] arrayWithObjects: @"image1", "image2", @"image3", nil];

NSMutableDictionary *theDictionary = [[NSMutableDictionary alloc] retain];

[theDictionary setObject:shopNameArray forKey:@"Shop Name"];
[theDictionary setObject:shopLocationArray forKey:@"Shop Location"];
[theDictionary setObject:shopImageArray forKey:@"Shop Image"];

return theMechanicDictionary;
}

Thanks.

  • 1 1 Answer
  • 1 View
  • 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-15T20:43:17+00:00Added an answer on May 15, 2026 at 8:43 pm

    Fixed block of code:

    - (NSDictionary *) returnDictionary {
        self.shopNameArray = [NSArray arrayWithObjects: @"Item 1", @"Item 2", @"Item 3", nil];
        self.shopLocationArray = [NSArray arrayWithObjects: @"Cincinnati, OH", @"Phoenix, AZ", @"Tuscon, AZ", nil];
        self.shopImageArray = [NSArray arrayWithObjects: @"image1", "image2", @"image3", nil];
    
        NSMutableDictionary *theDictionary = [NSMutableDictionary dictionary];
    
        [theDictionary setObject:self.shopNameArray forKey:@"Shop Name"];
        [theDictionary setObject:self.shopLocationArray forKey:@"Shop Location"];
        [theDictionary setObject:self.shopImageArray forKey:@"Shop Image"];
    
        return theDictionary;
    
    }
    

    Changes made:

    1. [NSArray arrayWithObjects:… is the format for the particular class method you are trying to call.
    2. [NSMutableDictionary dictionary] is the easiest way to get an autoreleased mutable dictionary. Like @Douwe suggested, you may want to init this object with a starting size of 3, but that’s not necessary. It only makes a difference if you’re loading a butt-ton of objects into your dictionary and you don’t want it to continuously be resizing itself.
    3. When adding the arrays to your dictionary, you shouldn’t reference them by the name of the iVar. Since you set the arrays using properties (self.shopNameArray =) the name of the iVar will not necessarily be the same.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This doesn't seem to work (compiler complains that Something 's getFoo() method doesn't implement
I'm using this method to install an application, but it doesn't put the applications
Object doesn't support this property or method It's this line. pthumb = $(#pthumb).attr(src); Does
I'm getting a Object doesn't support this property or method error, does anyone know
I have this AJAX code, but it doesn't seem to throw the 'alert' method.
I first tried to override the delete() method but that doesn't work for QuerySet's
I have a database entry that I need to update. This method obviously doesn't
I can't figure out why this UIView doesn't display correctly when the method is
Usually I open a new window like this: new Sensors(this).Show(); this.Hide(); But this method
Extract Method (a refactoring from Fowler's book) works great if your method doesn't assign

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.