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 trialRASHU BHATNAGAR
Courses Plus Student 2,669 PointsDownloading and Parsing JSON Data
Hi guys i am referring to this video: http://teamtreehouse.com/library/build-a-blog-reader-iphone-app-2/getting-data-from-the-web/downloading-and-parsing-json-data-2
It is regarding the extra credit question. I am some how not able to get what are they asking to be displayed on the blog reader table view . I did every thing as i was taught and the app uptil now in the simulator works just fine. But the extra credit question i am not able to get what exactly they want us to do. Please help
3 Answers
RASHU BHATNAGAR
Courses Plus Student 2,669 PointsThanks Natacha S. for the prompt reply.
This is what i am doing in the - (void)viewDidLoad method. and I am still not able to get what am i doing wrong.
NSURL *blogURL=[NSURL URLWithString:@"https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=JSON"];
NSData *jsonData=[NSData dataWithContentsOfURL:blogURL];
// NSLog(@"%@",jsonData);
NSError *error=nil;
NSDictionary *dataDictionary=[NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
NSLog(@"%@",dataDictionary);
self.blogPosts=[dataDictionary objectForKey:@"results"];
The app is working fine in the simulator, i mean there are no errors. but no data is showing on the table view in simulator.
Please help...
Natacha S
11,561 PointsThey want you to use a different set of data to import into your blog reader. For example they'd like to see the data returned by a random google search, that you determine by modifying what comes after the "q="
RASHU BHATNAGAR
Courses Plus Student 2,669 PointsThanks for replying back Amit. It works fine now.... Thanks once again
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherYou have to look at the structure of the data that is presented to you.
As you can see above you have a dictionary which contains a key called
responseData
within that you have theresults
. So you can't directly access the results. You would need to use the methodvalueForKeyPath
.self.blogPosts = [dataDictionary valueForKeyPath:@"responseData.results"];