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 trialSascha Keller
Courses Plus Student 7,467 PointsHi i tried to code exactly as you say in the video but it gives an error when running it. NSURL? not unwrapped??
Hi i tried to code as you say in the video but it gives an error when running it. NSURL? not unwrapped?? also the download files give the same error
Sascha Keller
Courses Plus Student 7,467 Pointsclass ViewController: UIViewController {
//Replace the string below with your API Key.
private let apiKey = "4de5319c1c8991a1ff2985013795b0b3"
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let baseURL = NSURL(string: "https://api.forecast.io/forecast/\(apiKey)/")
let forecastURL = NSURL(string: "37.8267,-122.423", relativeToURL: baseURL)
let weatherData = NSData.dataWithContentsOfURL(forecastURL, options: nil, error: nil)
println(weatherData)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
2 Answers
Jake Johnson
6,839 PointsI just posted some code that compiles correctly under the Questions section of this video. Given that Swift has changed quite a bit, the code in the video will not work until it gets updated by the Treehouse team. My code compiles and at least will let you move forward with the course until they get a chance to rework the material. Hope it helps!
TEKK YE
1,087 PointsI walk around of the problem by omitting the space between latitudes.
Patrick Gerrits
14,614 PointsPatrick Gerrits
14,614 PointsPlease give us some more information about what code you have right now?