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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:41:41+00:00 2026-05-23T23:41:41+00:00

Newbie here, I have a single component picker set up from a plist, with

  • 0

Newbie here,

I have a single component picker set up from a plist, with each item being an array, with multiple strings in each array that the app uses.

Currently the plist structure is like this:

NSDictionary  ->  NSArray  ->  NSString
                     |             |
            Items in Picker     Data for each Item

But now, I want:

NSDictionary  ->  NSDictionary  ->  NSArray  ->  NSString
                      |                |              |
  DIfferent Picker Data Sets      Items in Picker   Data for each Item

So now there would be multiple sets of picker components that I would show using a segmented control etc…

I’m not even sure if this is possible, and I was only hoping it would save me from making many different separate picker controllers.

What has me stumped is just getting everything ingested properly

This is what I have now, it builds successfully but crashes (debug info below):

NSBundle *bundle = [NSBundle mainBundle];

NSString *plistPath = [bundle pathForResource:@"CamerasDatabase" ofType:@"plist"];

NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
self.allCameras = dictionary;
[dictionary release];

NSArray *cameraTypes = [self.allCameras allKeys];
self.CamTypes = cameraTypes;

NSArray *items = [self.CamTypes objectAtIndex:0];
self.Cameras = items;

NSString *selectedCamera = [self.Cameras objectAtIndex:0];
NSArray *array = [CamsList objectForKey:selectedCam];
self.cameraData = array;

I’ve tried many different combinations of dictionaries, arrays, and strings so I’m sure the above code is messed up.

It crashes at:

NSString *selectedCamera = [self.Cameras objectAtIndex:0];

with “-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x4e127f0”

  • 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-23T23:41:41+00:00Added an answer on May 23, 2026 at 11:41 pm

    It is obvious, you are having NSString objects (keys) in self.CamTypes. Not NSArray.

    so these lines are invalid

    NSArray *items = [self.CamTypes objectAtIndex:0];
    self.Cameras = items;
    
    NSString *selectedCamera = [self.Cameras objectAtIndex:0]; //this line is cause of exception.
    

    for fixing this write code some thing like this

    NSBundle *bundle = [NSBundle mainBundle];
    
    NSString *plistPath = [bundle pathForResource:@"CamerasDatabase" ofType:@"plist"];
    
    NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
    self.allCameras = [dictionary valueForKey:@"Key "];//Key for accesing your inner dictionary
    [dictionary release];
    
    
    
    NSArray *cameraTypes = [self.allCameras allKeys];
    self.CamTypes = cameraTypes;
    
    
    NSArray *items = [self.allCameras valueForKey:[self.CamTypes objectAtIndex:0]];
    self.Cameras = items;
    
    NSString *selectedCamera = [self.Cameras objectAtIndex:0];
    NSArray *array = [CamsList objectForKey:selectedCam];
    self.cameraData = array;
    

    so in above code self.allCameras is the dictionary which having arrays corresponding different key (cameraTypes which are in self.CamTypes).

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

Sidebar

Related Questions

Newbie here, I have a struct for a word, which contains a char array
ASP.NET newbie here I have coded up an ASP.NET website and running on win'08
Java Newbie here. I have a JFrame that I added to my netbeans project,
REAL newbie here to Objective C and Cocoa. I have this 'if statement' if
Pardon the dumb newbie question here; web programming isn't my forte... (blush) I have
This is sort of SQL newbie question, I think, but here goes. I have
python newbie here. I'm writing the code to control an experiment that has multiple
A rails newbie here I have 2 actions in my controller 1) index 2)
Newbie here. I have this code: while (v < 360) { v +=10; RunIt();
Perl newbie here. I have a log file that I need to parse out

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.