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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:53:24+00:00 2026-06-11T13:53:24+00:00

I have an NSDictionary filled with data. If this was php it might be

  • 0

I have an NSDictionary filled with data. If this was php it might be accessed by  something like:

$data = $array['all_items'][0]['name'];

How do I do something similar in objective c? ($array would be an NSDictionary)

  • 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-06-11T13:53:26+00:00Added an answer on June 11, 2026 at 1:53 pm

    The equivalent code in Objective-C is:

    id data = [[[array objectForKey:@"all_items"] objectAtIndex:0] objectForKey:@"name"];
    

    Note that objectForKey: is a method of NSDictionary, and objectAtIndex: is a method of NSArray.

    A shortcut in Xcode 4.5, using LLVM 4.1, is:

    id data = array[@"all_items"][0][@"name"];
    

    Also note that if “array” is an NSDictionary instance and you want to get an array of all values in the dictionary, you use the allValues method of NSDictionary:

    id data = [array allValues][0][@"name"];
    

    Of course, allValues returns an unsorted array, so accessing the array by index is not very useful. More typically, you’d see:

    for (NSDictionary* value in [array allValues])
    {
        id data = value[@"name"];
        // do something with data
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the question explains it all. For instance, if I have a NSDictionary like this
I have a NSDictionary like this one. PhotoData = { 1 = { jf_photo_geotag
I have a NSDictionary that contains data converted from json data, like {message_id:21} .
Let's say I have an NSDictionary with a nested NSDictionary like this (simplified, I
i have a NSDictionary of this type : ********** = ( 20110330 7Huge Sandstorm
I have a NSDictionary called data and when I print using NSLog it gives
I have an NSDictionary that holds all the data: One title (not important for
I have this NSDictionary: Categorys = { Category = ( { categoryDescription = {
I have a simple NSDictionary that I am trying to populate with data from
I have this NSDictionary that I want to load into a table view. It

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.