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

Build a Weather App in Swift Concurrent Code

I am getting a red "stop sign" that says when I click on it that items in series must be separated by a "," but everything is. The error is on the "let downloadTask" line.

Can anyone please help to give me a clue on how to solve this?

Here is the code:

let downloadTask: NSURLSessionDownloadTaskWithURL(forecastURL, completionHandler: {(location:NSURL!,response:NSURLResopnse!, error: NSError!) -> Void in code
            println(response)

2 Answers

It looks like one of the auto complete snippets didn't expand. It should look something like this,

let downloadTask: NSURLSessionDownloadTask = sharedSession.downloadTaskWithURL(forecastURL!, completionHandler: { (location: NSURL!, response: NSURLResponse!, error: NSError!) -> Void in
  println(response)
})

Everything was correct but for the "!" after the forecastURL. Thank you Daniel!

It is pretty though to answer as I do not know at what point you are in the making of the app.

But I think this misses the actual calling of the concurrent task..

Something like " = sharedSession.downloadTaskWithURL" right after NSURLSessionDownloadTaskWithURL, but I am not 100% sure

Thank you Vittorio, it worked!