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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:23:53+00:00 2026-05-26T05:23:53+00:00

I have the following format in my plist: I’m using this code which works

  • 0

I have the following format in my plist:

enter image description here

I’m using this code which works fine to pull all muscleName and set them as the table’s cell’s textLabel:

    NSString *path = [[NSBundle mainBundle]pathForResource:@"data" ofType:@"plist"];
    NSMutableArray *rootLevel = [[NSMutableArray alloc]initWithContentsOfFile:path];
    self.muscleArray = rootLevel;
    cell.textLabel.text = [[self.muscleArray objectAtIndex:indexPath.row]objectForKey:@"muscleName"];

But now I’m adding a search bar, and I want the results to show the exerciseName with corresponding muscleName and musclePicture keys.

I tried just doing [[self.muscleArray objectAtIndex:indexPath.row]objectForKey:@"exerciseName"]; but that doesn’t fetch anything

  • 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-26T05:23:53+00:00Added an answer on May 26, 2026 at 5:23 am
    [[self.muscleArray objectAtIndex:indexPath.row]objectForKey:@"exercises"] 
    

    Will give you an NSArray holding two dictionaries (from the data above), each dictionary holding a string for the key exerciseName. You can also do

    [[[self.muscleArray objectAtIndex:indexPath.row]objectForKey:@"exercises"] valueForKey:@"exerciseName"]
    

    Which will return you an NSArray of NSStrings holding the two exercise names.

    Your data isn’t really laid out in a way that facilitates a nice search. You are trying to search within a dictionary contained within an array contained within a dictionary contained within an array! It might be worth creating an alternate array for search purposes – that would be done something like this:

    NSMutableArray *arrayForSearching = [NSMutableArray array];
    for (NSDictionary *muscleDict in self.muscleArray)
        for (NSDictionary *excerciseDict in [muscleDict objectForKey:@"exercises"])
            [arrayForSearching addObject:[NSDictionary dictionaryWithValuesAndKeys:
                [exerciseDict objectForKey:@"exerciseName"],@"exerciseName",
                [muscleDict objectForKey:@"muscleName"],@"muscleName",nil]];
    

    (typed in browser and untested, so please forgive any errors!)

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

Sidebar

Related Questions

I have the following code. This displays data in following format H:M:S. I would
I have XML in the following format which I want to reformat: <blocks> <!--
I have a filename that has the following format: timestamp-username-1 This file is constantly
I have following format of JSON in which I want to access 0.4, kem,
i have a following format of the result set in sql server TagId Tag
Localizable strings file which are used for Apple/iPhone apps localization have the following format:
SO I have the following set of code parsing delicious information. It prints data
SO I have the following set of code parsing delicious information. It prints data
I have a .plist created at the application launch with the following code (MyAppTableViewController):
Have three tables Vehicle, VehicleGroup and AssignedVehicleGroup which have the following format: Vehicle -

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.