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

having problems running Treehouse Blog Reader app

when i try and run the simulator is says

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<TableViewController 0x717c4f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key dataSource.'
*** First throw call stack:

in the debug section

10 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

It might be that you are directly trying to set a value on your controller that does not exist. Please post your code if you are still having an issue.

I can't run mine either, this is my error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'

I have compared my code side-by-side to Amit's

When my crash occurs it shows the 'main' with this line highlighted in green:

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); }

implementation:

[super viewDidLoad];

NSURL *blogURL = [NSURL URLWithString:@"blog.teamtreehouse.com/api/getrecentsummary"];
NSData *jsonData = [NSData dataWithContentsOfURL:blogURL];

NSError *error = nil;

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

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

ok now it is working without a crash but the view is blank.

I first removed the "_" underscore between words in the url then added the http://

so now the simulator will run but with an empty screen

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Have you modified the methods related to the table view?

No I have not. Since there we no RED errors and I spent quire some time reviewing the videos many times I still could not figure out what i did wrong. So I pasted your code in and replaced mine, but only the small amount below superViewDidLoad and it worked. It is weird tho! I am usually at fault with user error but my code looked like your code. but yours works.

Amit you are a great instructor, Please Continue what you do. After the IOS learning I don't see a need to subscribe.

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Thank you. Appreciate the kind words. Once you modify the methods related to the table view you should see the blog post title appear in the simulator.