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

I want to integrate the app with a weather api to get current weather. How would I implement it into the diary app?

I also want to include an add location section in the entryviewcontroller

1 Answer

Hi Anthony,

First you would need to use the CoreLocation Framework in order to grab the user's coordinates. Second, use those coordinates to create the link towards forecast.io also using your API key. The answer coming from forecast.io API can be handled using the same method as in the Stormy app, NSJSONSerialization.

As for where do you display all the data is all up to you - change the design of the diary app to suit your needs. I would suggest grabbing the location and weather data at the start of the app or after the start, using a background network session so it doesn't block the app until the answer comes. You can update the weather every time the user is trying to post something in the diary, this way you don't need to "force" the user to press an update button.