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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:19:22+00:00 2026-06-16T18:19:22+00:00

Currently I’m working on an application that will have a UITableView for a news

  • 0

Currently I’m working on an application that will have a UITableView for a news section. I will be making an API call to retrieve the news to populate the cells in the tableView. Currently I’m returning the data via JSON and here is what the JSON response looks like: (put on newline so reading the structure was a bit easier on the eye)

[
    {
        "news_id": "1",
        "news_title": "Sample headline",
        "news_date": "2012-12-19",
        "news_news": "news article 1",
        "news_priority": "3"
    },
    {
        "news_id": "2",
        "news_title": "On the Outside, Looking in",
        "news_date": "2012-11-20",
        "news_news": "news article 2",
        "news_priority": "2"
    },
    {
        "news_id": "3",
        "news_title": "Fla. Plans to Mark Death Penalty's Return",
        "news_date": "2012-12-23",
        "news_news": "news article 3",
        "news_priority": "1"
    }
]

Before JSON encoding via php my array looks like so:

Array
(
[0] => Array
    (
        [news_id] => 1
        [news_title] => Sample headline
        [news_date] => 2012-12-19
        [news_news] => news article 1
        [news_priority] => 3
    )
[1] => Array
    (
        [news_id] => 2
        [news_title] => On the Outside, Looking in
        [news_date] => 2012-11-20
        [news_news] => news article 2
        [news_priority] => 2
    )
[2] => Array
    (
        [news_id] => 3
        [news_title] => Fla. Plans to Mark Death Penalty's Return
        [news_date] => 2012-12-23
        [news_news] => news article 3
        [news_priority] => 1
    )
)

I’m storing the response by doing the following:

// populate the dictionary with the json response.
NSDictionary *data = [NSJSONSerialization JSONObjectWithData:returnData options:NSJSONReadingMutableContainers error:&error];
return data;

// model has a method to construct the url request/connection etc   
NSDictionary *newsDict = [model makeServerAPICall:kURL postMessage:@"method=getNews"];
NSString *string = [newsDict objectForKey:@"news_id"];

Up to this point everything is appearing to be fine except when I try to access an element inside of the array I get this crash with error:

-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0xab13a40
Even though this is an NSDictionary. I’m quite confused at this point because “data” is an NSDictionary.

I’m trying to setup my tableView with the returned data having the news_title be listed in the cell and when selected will push to a detail view displaying the relative data for that article. I’ve made many API calls where the returned data is very simple JSON format. This is my first attempt at extracting the data containing multiple arrays from a JSON response. Honestly at this point I do not know where else to go from here. Any help would be much appreciated.

  • 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-16T18:19:23+00:00Added an answer on June 16, 2026 at 6:19 pm

    You are quiet confused.

    • You are NOT getting a DICTIONARY from the server.
    • What you are actually getting is AN ARRAY OF DICTIONARIES.
    • So, [model makeServerAPICall:kURL postMessage:@"method=getNews"]; will NOT RETURN a dictionary.
    • It actually returns an Array of dictionary.

    So This code will solve your problem.

    NSArray *dictArray = [model makeServerAPICall:kURL postMessage:@"method=getNews"];
    for(NSDictionary *newsDict in dictArray){
        NSString *string = [newsDict objectForKey:@"news_id"];
        NSLog(@"%@", string);
    }
    

    That will solve your problem.

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

Sidebar

Related Questions

Currently working on a multi-tenant application, have an issue in generating identifier in a
Currently, I am writing a MiddleWare application that synchronizes information between and accounting application
Currently, I'm working on a project where I have a server - client relationship
Currently I have 2 ways of displaying images in a cell, which way will
Currently working with converting SQLException error messages into messages that are more useful for
Currently i have a node.js and socket.io application in development on my local machine
Currently I am working on small application in asp.net mvc. It is a some
Currently I have two projects that are separate from one another. The first is
Currently everything is working golden except for the fact that a user could manually
Currently I have an ActionFilter that gets the current users name from HttpContext and

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.