My UIImage is not loading the URL I specified with [NSData datawithContentsOfURL:], even though the URL is (seemingly) correct.
Here's my configureCell: method:
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
NSString *url = [photoUrls objectAtIndex:indexPath.section];
cell.imageView.image = [UIImage imagewithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]];
}
Here's what is inside of the "photoUrls" array (excluding bullet points):
(
)
I wouldn't use [nsdata dataWithContentsOfURL:] in configure cell as it will block the UI. And also the way you have it, it will redownload all the images over and over again.
The following links will help you download the data asynchronously with out blocking the UI.
https://github.com/rs/SDWebImage
With This SDWebImage all you have to do is: [cell.imageView setImageWithURL:[NSURL URLWithString:urlString] placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; it will take care of downloading the image.