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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:14:08+00:00 2026-05-31T12:14:08+00:00

I have just started writing apps for IOS5. I currently have a PHP webservice

  • 0

I have just started writing apps for IOS5. I currently have a PHP webservice that the app calls to retrieve data from database. In the database I have 3 rows at the moment, and when I go into the debugger the dictionary has 3 key/value pairs. I cannot retrieve any of the values though. My Code below:

NSURL *myUrl = [[NSURL alloc]initWithString:@"http://localhost/~stephen-hill9/index.php"];
NSData *data = [[NSData alloc] initWithContentsOfURL:myUrl];
NSError *error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSLog(@"Parsed Data: %@", json);
NSDictionary *bodyDictionary = [json objectForKey:@"Product_Desc"]; <-APP CRASHES HERE - INVALID KEY
NSLog(@"Parsed Data: %@", bodyDictionary);

Also, here is the data that the dictionary contains which I got from the debugger:

Parsed Data: (
        {
        0 = 1;
        1 = "Caromax 20HN B/F";
        2 = 51533;
        3 = 6650;
        4 = 1117760;
        5 = 1067224;
        6 = 1759741;
        7 = 1;
        8 = "0000-00-00 00:00:00";
        ID = 1;
        "Max_Volume" = 1759741;
        "Product_Code" = 51533;
        "Product_Desc" = "Caromax 20HN B/F";
        Pumpable = 1067224;
        Status = 1;
        "Tank_Level" = 6650;
        Updated = "0000-00-00 00:00:00";
        Volume = 1117760;
    },
        {
        0 = 2;
        1 = "C1 Kerosine";
        2 = 25101;
        3 = 1258;
        4 = 146871;
        5 = 111776;
        6 = 1018590;
        7 = 2;
        8 = "2023-02-12 20:00:00";
        ID = 2;
        "Max_Volume" = 1018590;
        "Product_Code" = 25101;
        "Product_Desc" = "C1 Kerosine";
        Pumpable = 111776;
        Status = 2;
        "Tank_Level" = 1258;
        Updated = "2023-02-12 20:00:00";
        Volume = 146871;
    },
        {
        0 = 3;
        1 = "Recovered Spirit";
        2 = 87902;
        3 = 6069;
        4 = 710172;
        5 = 675078;
        6 = 1018200;
        7 = 1;
        8 = "2012-03-16 00:00:00";
        ID = 3;
        "Max_Volume" = 1018200;
        "Product_Code" = 87902;
        "Product_Desc" = "Recovered Spirit";
        Pumpable = 675078;
        Status = 1;
        "Tank_Level" = 6069;
        Updated = "2012-03-16 00:00:00";
        Volume = 710172;
    }
)

I hope someone is able to help – I am sure the problem must be something basic.

Many thanks in advance,

Stephen

  • 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-31T12:14:09+00:00Added an answer on May 31, 2026 at 12:14 pm

    Ok, what you ‘ve got here is an Array of Dictionaries, not a Dictionary itself.
    Try this:

    NSArray *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
    NSDictionary *bodyDictionary = [json objectAtIndex:0];
    

    Of course this will get you the first object only, but you get the idea…

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

Sidebar

Related Questions

I have just started writing socket programs. Came to know that single UDP packet
gcc 4.4.2 cmake 2.6 I have just started using cmake. Coming from writing my
I have just started including networking functionality into my apps. I know that you
I have just started writing my own JavaScript Framework (just for the learning experience),
I have just started learning Jquery and am new to writing javascript (I am
I have just installed C# 2008 Express Edition 2008 and started writing code. My
I'm just getting started writing an app for WP (Mango), and am running into
I have just started learning XNA. This is my first program that I am
An ASP.Net MVC 3 application I've just started writing needs to have authentication for
I just started writing pub/sub and the way that I doing this is that

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.