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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:42:47+00:00 2026-06-12T16:42:47+00:00

I have seen several posts on this here at SO but those solutions don’t

  • 0

I have seen several posts on this here at SO but those solutions don’t seem to work for me. Perhaps it’s because I’m getting the image URL via JSON. All other text fields in JSON are coming through OK, it’s just the image that I can’t display and get a SIGABRT error.

The code in question is this:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"PostCell";

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

    NSDictionary *post           = [posts objectAtIndex:indexPath.row];
    NSString     *postText       = [post objectForKey:@"post_text"];
    NSString     *postAuthorName = [post objectForKey:@"post_author_name"];
    NSString     *postPictureUrl = [post objectForKey:@"post_picture"];
    NSData       *data           = [NSData dataWithContentsOfURL:[NSURL URLWithString:postPictureUrl]];

    cell.textLabel.text       = postText;
    cell.detailTextLabel.text = [NSString stringWithFormat:@"by %@", postAuthorName];
    cell.imageView.image      = [UIImage imageWithData:data];

    return cell;
}

My Table Cell is subtitle with no other changes or wiring.

Any idea where I’m messing up?

PS My full code using async request

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"PostCell";

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

    NSDictionary *post           = [posts objectAtIndex:indexPath.row];
    NSString     *postText       = [post objectForKey:@"post_text"];
    NSString     *postAuthorName = [post objectForKey:@"post_author_name"];

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *postpictureUrl = [post objectForKey:@"http://example.com/post/1200"];
        NSData   *data           = [NSData dataWithContentsOfURL:[NSURL URLWithString:postpictureUrl]];

//      NSLog(@"%@", data);

        dispatch_async(dispatch_get_main_queue(), ^{
//            [[cell imageView] setImage:[UIImage imageWithData:data]];
        });
    });

    cell.textLabel.text       = postText;
    cell.detailTextLabel.text = [NSString stringWithFormat:@"by %@", postAuthorName];

    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-06-12T16:42:49+00:00Added an answer on June 12, 2026 at 4:42 pm

    A few minor changes and the below works (ie, thumbnail shows to the left of title and subtitle).

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"cell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
        if (cell == nil) {
    
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
        }
    
        NSDictionary *post           = [posts objectAtIndex:indexPath.row];
    
        cell.textLabel.text       = [post objectForKey:@"post_text"];
        cell.detailTextLabel.text = [post objectForKey:@"post_author_name"];
    
        NSString *postpictureUrl = [post objectForKey:@"picture"];
        NSData   *data           = [NSData dataWithContentsOfURL:[NSURL URLWithString:postpictureUrl]];
    
        cell.imageView.image = [UIImage imageWithData:data];
    
        return cell;
    }
    

    Note the use of initWithStyle:UITableViewCellStyleSubtitle instead of Default.

    The guide here is an important read:
    http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html

    Finally, note this is synchronous downloading of images which will not work in the real world.
    So I’ll be posting another question on SO about the best solution for this.

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

Sidebar

Related Questions

I have seen several posts similar to this but none with a strait forward
I've seen several posts for this issue but didn't found my solution. I'm trying
I've seen several other posts similar to this (namely https://stackoverflow.com/questions/5237/solutions-for-working-with-multiple-branches-in-asp-net ) but there are
I have seen several other posts with similar questions but nothing exactly like what
I have seen several posts on how to dismiss a dialog by clicking on
I have read several post on both matters but I haven't seen anyone comparing
I have seen several questions with people asking about the same problem but none
I've seen several posts here on the subject, and I've read the W3C spec
I've seen several threads with the same issue, but none of the solutions seems
I've seen several posts here on SO about loading XML documents from some data

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.