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 trialSayana Narayanan
1,221 Pointsjson data
hai, i couldnt run the json first programe under downloading and parsing json data....
no errors showing when i start compiling..but during compilation shows the below error... "terminating with uncaught exception of type NSException..."
can you help me.....
10 Answers
Thomas Nilsen
14,957 PointsYour mistake is writing "@jsondata". looking back at the project it's supposed to be something like this:
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];
Thomas Nilsen
14,957 PointsTry adding an exception breakpoint - and run the code again :) That should show you the line that's causing problems.
Sayana Narayanan
1,221 PointsThanks....
Thomas Nilsen
14,957 PointsDid you work it out?
Sayana Narayanan
1,221 PointsYes, I did....but,It is showing the same error. ...
Thomas Nilsen
14,957 PointsIf it points to a line in your code, do you mind pasting it in here so we can have a look?
Sayana Narayanan
1,221 PointsActually I am running the whole code.... how can I add an " exception breakpoint "....sorry I dont know about it...
I added break points at the starting of json data link declaration ....while running its juz showing" breakpoint 1.1" on a green line
Thomas Nilsen
14,957 Pointsdo it like this, and run the code again:
Sayana Narayanan
1,221 PointsNSDictionary *blogspot = [NSJSONSerialization JSONObjectWithData:@"jsondata" options:0 error:&error];
pointing this line
Sayana Narayanan
1,221 Pointscouldnt see full code.... can you please paste it fully
Thomas Nilsen
14,957 Pointslike so:
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];
Sayana Narayanan
1,221 PointsFinally it works :-)
thank you so much