Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Blog Reader Extra Credit SDWebImage

Hey Amit Bijlani! I took your challange and have after hours of scratching my head figured it out! I have come to a much better understanding of the BlogReader app. As I had to to solve the puzzle. The only thing to notice is that it doesn't load the images before I've entered the page which isn't really optimal in our case. But I believe the framework was designed that way. A way to circumvent this? The API documentation site is parked at a domain host. The github page didn't make me much wiser either. The relevant part of my code.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    BlogPost *blogPost = [self.blogPosts objectAtIndex:indexPath.row];

    if ( [blogPost.thumbnail isKindOfClass:[NSString class]]) {
    //NSData *imageData = [NSData dataWithContentsOfURL:blogPost.thumbnailURL];

//    UIImage *image = [UIImage imageWithData:imageData];
//    cell.imageView.image = image;

     [cell.imageView setImageWithURL:[NSURL URLWithString:blogPost.thumbnail]
     placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

    //[cell.imageView.image = [UIImage setImageWithURL:blogPost.thumbnailURL];

    } else {
        cell.imageView.image = [UIImage imageNamed:@"treehouse.png"];
    }

This rendered the ThumbnailURL method unused which was part of the headache.