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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:54:01+00:00 2026-05-23T02:54:01+00:00

I am having some problem with my UITableView. I am downloading the data and

  • 0

I am having some problem with my UITableView. I am downloading the data and setting up the cells like usual, but this time with the NSThread added.

First I will call ASIHTTPRequest in my view did load

Then in – (void)requestFinished:(ASIHTTPRequest *)request I will add the url of the thumbnail into an NSMutableArray

 NSString *photoURLString = [NSString stringWithFormat:@"http://some.url.com/img/%@",[thearray objectForKey:@"tn_url"]];    
[thumbNailURL addObject:(photoURLString)];

And in the cellForRowAtIndexPath: where I am setting up other data to display, I will call my NSThread

[NSThread detachNewThreadSelector:@selector(loadImage:) toTarget:self withObject:indexPath];

And in my loadImage thread

- (void) loadImage: (NSIndexPath*) indexPath{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *iconURL = [thumbNailURL objectAtIndex:indexPath.row];
NSURL *url = [NSURL URLWithString:iconURL]; 
UIImage *icon = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
cellImageView = [[UIImageView alloc] initWithFrame:CGRectMake(11.0, 6.0, 61.0, 50.0)];
[cellImageView setImage:icon];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
[cell.contentView performSelectorOnMainThread:@selector(addSubview:) withObject:cellImageView waitUntilDone:NO];
[pool drain];

}

All the data and image loaded just fine, but if I scroll faster up and down , the application will hang with the following error

[1997:7a1f] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 6 beyond bounds [0 .. 5]'    (0x31312d2f 0x345f50e3 0x3127d1b1 0x35aefc1d 0xf4dd 0x333ffb51 0x3347c67b 0x366af589 0x366b2310) terminate called throwing an exceptionProgram received signal:  “SIGABRT”.

It would be great if anyone could show me the correct configuration if I am wrong, as I have been trying different approaches for the past 3 days already.

  • 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-23T02:54:02+00:00Added an answer on May 23, 2026 at 2:54 am

    A couple things.

    First, I would recommend you consider using something like SDWebImage for async image downloading (looks like Olivier Poitrey is the original author). Github repository here: https://github.com/rs/SDWebImage. I use it for this very purpose and it’s great.

    That said, I see a few things here.

    1) You don’t seem to be checking if the cell image is already set… no need to re-download the image if you’ve already got it. You might get away with this since dataWithContentsOfUrl might offer some caching, but I’m not sure.

    2) I can’t tell from the code here, but you need to be sure you don’t allow the table view to load it’s data until after requestFinished is called. Otherwise you’ll have a race condition that could cause the type of error you are seeing. Consider setting the tableView’s data source in the requestFinished method and then calling reloadData. Otherwise, do as downed suggested and just prefill the URL array with [NSNull null] objects.

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

Sidebar

Related Questions

I am having some trouble with this code . The problem is when i
I'm new to Ruby, so I'm having some trouble understanding this weird exception problem
i having some problem with TList and BinarySearch. I have this structure: PDoubleEstr =
I'm creating some UIButton s programmatically in a loop but I'm having some problem
I'm having a problem with UITableView, populated via Core Data. The table view is
I'm having some problem setting up an oauth provider with two-legged authentication. I'm using
I am having some problem mapping my Java Data Type to standard Schema Date
im having some problem with this code: if (count($_POST)) { $username = mysql_real_escape_string($_POST['username']); $passwd
I'm having some problem with Maven's scm element and subversion. I added the following
I've been having some problem with this code $(#click).bind('mousedown mouseup mouseover', function(e) { if(e.type

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.