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 Build a Blog Reader iPhone App Getting Data from the Web Downloading and Parsing JSON Data

Hector Romero
Hector Romero
6,151 Points

Retrieving data from Xively

Hi! I just watched this video and tried to retrieve data from Xively from a JSON like this: http://api.xively.com/v2/feeds/763256681.json and I couldn't. Can somebody help me? Thanks a lot!

1 Answer

Sam Chaudry
Sam Chaudry
25,519 Points

Hi Hector I just checked out the link? If the data requires access then your app needs to make a call to the server to get permission. You need to be using NSURLAuthenticationChallenge it has methods associated with which will allow your app firstly to get access to the data before parsing it.

Once you have ti then your need to parse in the url with NSURL and use NSJSONSerialization to retrieve the data your interested in.

Without seeing your full code I can't give you to much advice hope this helps!!

Hector Romero
Hector Romero
6,151 Points

Thanks, Sam. Here is my code: http://goo.gl/FIQFL4 I've just begun to build iOS apps and I don't really have ability using documentation. How can I implement NSURLAuthenticationChallenge you mentioned? Thanks so much!