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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:52:05+00:00 2026-06-11T14:52:05+00:00

I am very new with ios dev and I have been struggling with almost

  • 0

I am very new with ios dev and I have been struggling with almost everything so far. It’s really very frustrating really.

I have put the comment /code crashes here/ to indicate where my app flow stops. I am requesting the json data with

NSData* data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://192.168.2.4/iRestaurant/users"]];
    [self performSelectorOnMainThread:@selector(fetchedData:)
                           withObject:data waitUntilDone:YES];

The implementation for fetchedData

- (void)fetchedData:(NSData *)responseData {
//parse out the json data
NSError* error;
NSDictionary* json = [NSJSONSerialization
                      JSONObjectWithData:responseData //1

                      options:kNilOptions
                      error:&error];
//NSLog(@"%@", json);
NSArray* latestLoans = [json objectForKey:@"Users"]; //2
NSEnumerator* enumerator = [latestLoans objectEnumerator];
id element;

  while(element = [enumerator nextObject]) {
    Result *fetchedResults = [Result init];
    /*crashes here*/
    fetchedResults.name = [[element objectForKey:@"User"] objectForKey:@"name"]; 
    fetchedResults.email = [[element objectForKey:@"User"] objectForKey:@"name"];
    [results addObject:fetchedResults];objectForKey:@"name"]);
  }
}

Result is a custom object and is a subclass of NSObject. I have imported Result.h. I have also declared NSMutableArray *results in my current file’s declaration file. I am pushing the objects into results. The header file for Result looks like

@interface Result : NSObject

@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *email;
@property (nonatomic, assign) int ID;

@end

I will be implementing cellForRowAtIndexPath and pushing the contents of results into the reusable cell.

My JSON response is

{"Users":
    [{"User":
        {"id":"1",
         "name":"Kishor kundan",
         "email":"kis@kun.ca",
         "password":"asdfasdf",
         "fb_id":"1234444"
        }
     },
     {"User":         
        {"id":"2",
         "name":"adsfasdf",
         "email":"asdfasdf@asdf.asdf",
         "password":"asdfasdf",
         "fb_id":"123123"
     }
    }]
}
  • 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-11T14:52:06+00:00Added an answer on June 11, 2026 at 2:52 pm

    The code was crashing due to object not found. My code was referencing a location that was not there. I took @btype’s suggestion from my other question

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

Sidebar

Related Questions

I am very new to iOS Programming and have been learning for only a
I am very new to iOS development and have inherited some code. I have
I am very new at iOS and objective-c development, so I am struggling with
I'm very new to IOS programming and i have doubt with NSThread. My problem
I'm very new with iOS Development and I have just created one of my
I am very new to IOS programming. I have a task to find if
I'm very new to iOS. I have a UITableView that filled with many custom
i am very new to ios development, rather i have just started work on
I'm very new to RubyMotion and iOS development and I wanna put a top
I'm very new to the mobile arena and have played with both iOS 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.