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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:47:02+00:00 2026-05-11T19:47:02+00:00

I created a plist that contains an NSDictionary structure. The key is a label

  • 0

I created a plist that contains an NSDictionary structure. The key is a label (which I use to populate tableview cell.text) and the value is a file name that I want to use to ‘dynamically’ populate cell.image. The exact png filenames are loaded into the project.

To make things easier (so I thought), I load the plist into an NSDictionary, then pull that apart into two arrays (using allKeys and allValues).

In attempting to set a cell image, I dont understand why this works:

cell.image = [UIImage imageNamed:@"bad.png"];

and this does not (in simulator – I get an app crash and barfing in debugger):

cell.image = [UIImage imageNamed:[rowImageList objectAtIndex:indexPath.row]];

I can put this next line right before the second piece of code and it works just fine, so it appears that I am getting an NSString from objectAtIndex:

NSLog(@"Image name: %@", [rowImageList objectAtIndex:indexPath.row]);

I have also tried creating a temp NSString and assigning [rowImageList objectAtIndex:] to it, then using that NSString to supply imageNamed:.

Here is some info from debugger:

-[NSCFArray length]: unrecognized selector sent to instance 0x262d910

Terminating app due to uncaught
exception
‘NSInvalidArgumentException’, reason:
‘*** -[NSCFArray length]: unrecognized
selector sent to instance 0x262d910’

Let me know if you need more info/code.

Edit: Here’s how I populate rowImageList:

NSArray *myRowImages = [[NSArray alloc] init]; 
myRowImages = [searchFilterList allValues]; 
self.rowImageList = [myRowImages copy]; 
[myRowImages release]; 
//where searchFilterList is an NSDictionary that I loaded from a plist

Here’s a screenshot of my plist:
[IMG][http://i42.tinypic.com/14uwffa.jpg]1
[/IMG]

Edit: revised rowImageList population:

 NSMutableArray *myRowImages = [[NSMutableArray alloc] init];
 NSEnumerator *enumerator = [searchFilterList objectEnumerator];
 id object;

 while ((object = [enumerator nextObject])) {
     [myRowImages addObject:[object objectAtIndex:0]];
 }
 self.rowImageList = myRowImages; //edit: added self. prefix
 [myRowImages release];
  • 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-11T19:47:03+00:00Added an answer on May 11, 2026 at 7:47 pm

    I would double-check the output from NSLog() and make sure it’s not an array that contains an NSString. That’s what the error is telling you; you’re passing an NSArray where an NSString is expected.

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

Sidebar

Related Questions

I created a plist and the structure looks like: Root - NSDictionary firstName -
I have successfully created an app that reads from a bundled .plist file and
I've created a singleton class that loads a plist. I keep getting this error
I am reading in a pList file that I created. It has a list
I have created a PLIST. The structure of the PLIST is like this <?xml
I've created a small class that loads dictionary items from a plist file. The
Whether plist that I created, and made changes while app running, will be saved
I have a plist file that contains country, state, city. I can access the
I've created a plist (File->New File->Resource plist) file that has a dictionary that stores
i have created a plist file other than the default one that exists. Can

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.