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

  • Home
  • SEARCH
  • 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 6103505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:44:11+00:00 2026-05-23T13:44:11+00:00

I am trying to load JSON from a sever and then display it in

  • 0

I am trying to load JSON from a sever and then display it in a UITableView. The request goes fine however when I try to add the data to the tableview the app crashes when I call then [tableView reloadData] method is called. I have the variable jsonArray reference in the UITableView methods so that the TableView displays the contents of that variable. Is this the best way to do it and what am I doing wrong?

The connection

NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

Main HTTP Callback

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    [connection release];

    NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
    [responseData release];

    //Declare the parser
    SBJsonParser *parser = [[SBJsonParser alloc] init];

    jsonArray = [parser objectWithString:responseString];

    [tableView reloadData];

    [parser release];
    [responseString release];
}

Error

2011-07-07 14:42:56.923 Viiad[16370:207] -[__NSSet0 objectAtIndex:]: unrecognized selector sent to instance 0x5a4a0b0
2011-07-07 14:42:56.925 Viiad[16370:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSSet0 objectAtIndex:]: unrecognized selector sent to instance 0x5a4a0b0'

EDIT

UITableViewMethods

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    NSArray *results = [[jsonArray valueForKey:@"Rows"] valueForKey:@"name"];

    cell.textLabel.text = (NSString *)[results objectAtIndex:indexPath.row];
    return cell;
}
  • 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-23T13:44:12+00:00Added an answer on May 23, 2026 at 1:44 pm

    This message

    -[__NSSet0 objectAtIndex:]: unrecognized selector sent to instance 0x5a4a0b0
    

    means that someplace in the code, the objectAtIndex: message was sent to an instance of __NSSet0. To me, that looks like you’re passing around an NSSet where you’re expecting an NSArray.

    Set a debugger breakpoint before you call [results objectAtIndex:indexPath.row] and see what results actually contains. My guess is that the JSON parser isn’t returning what you think it is. Objective-C is dynamically typed: just because you say that a variable is an NSArray type doesn’t mean it can’t contain some other object. If a function returns type id, there is no type information for the compiler to check at all.

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

Sidebar

Related Questions

I'm trying to load a jqGrid from json data made via a REST call.
I'm trying to load data from an external .js file, containing a JSON representation
I'm trying to load data from the jsp response which is a JSON using
My Problem I am trying to load JSON encoded data from a remote site
I am trying to find a way to load a JSON page to display
I'm trying to get some json data from a remote website. I run my
I am trying to request JSON from Google Places API, but I am still
I'm trying to parse data from a page of JSON in my ASP.NET MVC
I'm trying to parse some JSON data from the Google AJAX Search API. I
I'm trying to load some data via. jquery $get_desc = SELECT tekst_id,overskrift FROM rr_tekster

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.