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 trialChris Stromberg
Courses Plus Student 13,389 PointsJavaScript Object Notation returning nil in Playground
When running this code in Playground weatherData returns nil instead of data. What is wrong? Note: apiKey is replaced with x's intentionally.
let apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" let baseURL = NSURL(string: "https://api.forecast.io/forecast/\(apiKey)/")
let forecastURL = NSURL(string: "37.8267,-122.423", relativeToURL: baseURL)
//fetch data from our URL store it in our data object
let weatherData = NSData.dataWithContentsOfURL(forecastURL, options: nil, error: nil)
The error shows up in the console: 2014-11-04 12:02:13.106 WeatherPlayground[1357:181520] NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9807)
Underneath this error, some of the data shows, some does not.
David Galindo
Courses Plus Student 2,294 PointsDavid Galindo
Courses Plus Student 2,294 PointsHello Chris I am also doing working on this project. If you look at the bottom of the page from the video "Making a Network Call" you will see the notes and updates that he changed. Hope this helps.