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

Why isn't the forecast API working in Playground?

I am trying to follow the steps in the simple weather app to run the simple weather app and one of the steps was to run it in playground. It stopped working on my mac, so I tried it on a second mac. Both are failing to work.

https://developer.forecast.io/

When I run this it just returns the api call in playground. When I check https://developer.forecast.io/ there have been no api calls against my account. If I copy it into the web it works fine. Thoughts? let forecastURL = "https://api.forecast.io/forecast/apikey/37.8267,-122.423"

So i updated the code to be let forecastURL = NSURL(sting: "https://api.forecast.io/forecast/apikey/37.8267,-122.423"), and when I check the console output it says some "https://api.forecast.io/forecast/apikey/37.8267,-122.423". I am not sure why this is showing as an optional.

So i updated the code to be let forecastURL = NSURL(sting: "https://api.forecast.io/forecast/apikey/37.8267,-122.423"), and when I check the console output it says some "https://api.forecast.io/forecast/apikey/37.8267,-122.423". I am not sure why this is showing as an optional.

Running let forecastURL = NSURL(sting:"https://api.forecast.io/forecast/apikey/37.8267,-122.423")! resolved the issue. However the training doesn't mention that they are optionals. I really want to understand this so any help is appreciated.

Running let forecastURL = NSURL(sting:"https://api.forecast.io/forecast/apikey/37.8267,-122.423")! resolved the issue. However the training doesn't mention that they are optionals. I really want to understand this so any help is appreciated.

1 Answer

I believe the video was not updated for xcode 6.1