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


Anand Altekar
Anand Altekar
1,617 Points

Blog Reader - use of undeclared identifier:author

Here is the code. I'm getting the above mentioned error.

import "AATableViewController.h"

import "BlogPost.h"

@interface AATableViewController ()


@implementation AATableViewController

  • (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; }

  • (void)viewDidLoad { [super viewDidLoad];

    self.tableView.contentInset = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f);

    NSURL *blogURL = [NSURL URLWithString:@"http://blog.teamtreehouse.com/api/get_recent_summary"];

    NSData *jsonData = [NSData dataWithContentsOfURL:blogURL];

    NSError *error = nil;

    NSDictionary *dataDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; NSLog(@"%@", dataDictionary);

    self.blogPosts = [NSMutableArray array];

    NSArray *blogPostArray = [dataDictionary objectForKey:@"posts"];

    for (NSDictionary *bpDictionary in blogPostArray) { BlogPost *blogPost = [BlogPost blogPostWithTitle:[bpDictionary objectForKey:@"title"]]; blogPost *author = [bpDictionary objectForKey:@"author"]; [self.blogPosts addObject:blogPost]; }


  • (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }

pragma mark - Table view data source

  • (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    // Return the number of sections. return 1; }

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    // Return the number of rows in the section. return [self.blogPosts count]; }

  • (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];

    cell.textLabel.text = blogPost.title; cell.detailTextLabel.text = blogPost.author; return cell; }

Rodrigo Chousal
Rodrigo Chousal
16,009 Points

Could you fix the formatting of the details of your question? Also, could you tell me in which line does the compiler show the error?