Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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?