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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:18:36+00:00 2026-05-22T14:18:36+00:00

NSDictionary *json = [responseString JSONValue]; Status *statut = [[Status alloc] init]; statut.flyNumber = [json

  • 0
NSDictionary *json    = [responseString JSONValue];
    Status *statut = [[Status alloc] init];
    statut.flyNumber = [json objectForKey:@"flynumber"];
    statut.ftatuts = [json objectForKey:@"fstatuts"];
    statut.escDepart = [json objectForKey:@"escdepart"];
    statut.escArrival = [json objectForKey:@"escarrival"];
    statut.proArrival = [json objectForKey:@"proarrival"];
    statut.proDepart = [json objectForKey:@"prodepart"];
    statut.estDepart = [json objectForKey:@"estdepart"];
    statut.estArrival = [json objectForKey:@"estarrival"];
    statut.realDepart = [json objectForKey:@"realdepart"];
    statut.realArrival = [json objectForKey:@"realarrived"];
    [dataToDisplay addObject:statut];

But if i will do like this :

Status *statut2 = [dataToDisplay objectAtIndex:indexPath.row];
    NSLog(@"2 ok");
    cell.textLabel.text =  [NSString stringWithFormat:@" %@  %@",statut2.escDepart,statut2.escArrival];
    NSLog(@"3 ok");

    return cell;

All information will be in one row .But i want to structured my informations in differents rows .For exemple in the first exemple , i want to put statut.escDepart and escArrival , in the second statut.proDepart and statut.proArrival ….
I tried to follow this exemple ,

// declare this enum in your .h file
enum {
    flyNumberRow   = 0, // first row in tableView
    ftatutsRow     = 1, // second row
    escDepartRow   = 2, // etc.
    escArrivalRow  = 3,
    proArrivalRow  = 4,
    proDepartRow   = 5,
    estDepartRow   = 6,
    estArrivalRow  = 7, 
    realDepartRow  = 8,
    realArrivalRow = 9

}

Status *statut2 = [dataToDisplay objectAtIndex:indexPath.row];

switch(indexPath.row) {
    case flyNumberRow:
        cell.textLabel.text =  [NSString stringWithFormat:@"%@",statut2.flyNumber];
        break;
    case ftatutsRow:
        cell.textLabel.text =  [NSString stringWithFormat:@"%@",statut2.ftatuts];
        break;
    // ... and so on for each case
}

return cell;

Evidently, tableView:numberOfRowsInSection: must return 10

But it don’t work .I have errors.Help me pleaaaase
this is the error .
http://hpics.li/b5653ce

  • 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-22T14:18:37+00:00Added an answer on May 22, 2026 at 2:18 pm

    You are adding a single instance of Status in dataToDisplay. So when the second row is requested, dataToDisplay has no second object and your application is crashing. I don’t think you should be using an array here. Since you know the number of cells already, manually return the numberOfRowsInSection: as 10. Instead of the array object, hold on to the Status object. Then in tableView:cellForRowAtIndexPath:, use the switch statement to assign values to the cell. From what I see, you can get rid of dataToDisplay.

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

Sidebar

Related Questions

I am using following code to parse JSON- NSString *responseString = [[NSString alloc] initWithData:responseData
I'm looking to create a crash-proof NSDictionary as I'm using a JSON serializer that
I have an Array of NSDictionary objects. These Dictionaries are parsed from a JSON
Here I am iterating through an array of NSDictionary objects (inside the parsed JSON
I am trying to call objectForKey: on an nsdictionary ivar, but I get an
I am parsing a JSON file. After getting the NSDictionary, I parse the objects
We are trying to convert the JSON object from NSSTRING TO NSDICTIONARY but we
I am using JSON framework (SBJson) for my applicaition. parsing the value by NSDictionary
I get the following NSDictionary when I parse a JSON response from my server:
I am using the SBJSON to convert my NSDictionary to a JSON String in

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.