Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

yi 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