0

So this is my Code:

TableViewController.h

@interface TableViewController : UITableViewController

@property (nonatomic, strong) NSArray *blogPosts;

@end

TableViewController.m

   - (void)viewDidLoad
    {
        [super viewDidLoad];

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



        self.blogPosts  = [dataDictionary objectForKey:@"posts"];
}

With this being displayed on the log

2014-04-15 20:21:48.884 BlogReader[772:60b] Cannot find executable for CFBundle 0xa181ef0 (not loaded)

rmaddy
  • 314,917
  • 42
  • 532
  • 579
DangoDoes
  • 35
  • 4
  • are you sure that this happened in this code? can you debug step by step and send the line of code that caused error? – Matrosov Oleksandr Apr 16 '14 at 00:28
  • Check this I suppose that is your issue: [answer link][1] [1]: http://stackoverflow.com/questions/18888059/cannot-find-executable-for-cfbundle-certuiframework-axbundle – Matrosov Oleksandr Apr 16 '14 at 00:31

1 Answers1

0

I forgot to make sure that the Author and Title strings matched the same ones as the ones in the JSON

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

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

    // Extracting 'Title' and 'Author' from dictionary to display in cell
    cell.textLabel.text = [blogPost valueForKey:@"title"];

    cell.detailTextLabel.text = [blogPost valueForKey:@"author"];

    return cell;
}
jbouaziz
  • 1,484
  • 1
  • 12
  • 24
DangoDoes
  • 35
  • 4