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 trialyi yuan
2,436 PointsSample Code doesn't work
I have followed the tutorial and also update the code syntax based on the Teacher's Notes, but let baseURL = NSURL(fileURLWithPath: "https://api.forecast.io/forecast/\(apiKey)/") let forecastURL = NSURL(string: location, relativeToURL: baseURL) let weatherData = NSData(contentsOfURL: forecastURL, options: nil, error: nil) still doesn't work. Even the code I download from the sample is still not working. Any idea or update, please help! Thanks.
5 Answers
Oliver Pinchbeck
2,732 PointsMaybe check your Xcode version? The NSData function changed between Xcode 6.0 and 6.1 I think
Ludwing Najera
4,596 PointsThe same thing's happening to me, and the console says "fatal error: unexpectedly found nil while unwrapping an Optional value". Does that mean anything to any of you?
Oliver Pinchbeck
2,732 PointsJust checking, but you put in your real API Key, right?
Ludwing Najera
4,596 PointsYes, I did put in my real API Key.
yi yuan
2,436 PointsStill don't know why. And this form has been well developed enough for me to easily find the answer or wait for answer. Waiting..
Queenie Peng
8,052 Points- Check if there's any space in baseURL and forecastURL
- Use "!" to unwrap the optional value