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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Asim Zaidi](https://secure.gravatar.com/avatar/45d60ca0bf0410bc418229687b085d7a?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Asim Zaidi
2,222 PointsError in sharedSession singleton closure
I am following the vide but I am blocked by this nasty error
here is my code
let baseUrl = NSURL(string: "https://api.forecast.io/forecast/\(apiKey)/")
let forecast = NSURL(string: "47.856223,-122.272590", relativeToURL: baseUrl)
let sharedSession = NSURLSession.sharedSession()
let downloadTask: NSURLSessionDownloadTask =
sharedSession.downloadTaskWithURL( forecast, completionHandler:
{ (loction: <#NSURL!#>, response: <#NSURLResponse!#>, error: <#NSError!#>) -> Void in
println(response);
})
}
here is where error happens { (loction: <#NSURL!#>, response: <#NSURLResponse!#>, error: <#NSError!#>) -> Void in println(response); })
here is error
1-expected an identifier to name generic parameter 2- expect parameter type following :
2 Answers
![Chris Shaw](https://secure.gravatar.com/avatar/89a81f4cc3cec373f6a1547fde9e8c26?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Chris Shaw
26,676 PointsHi Asim,
The issue is occurring with the below.
(loction: <#NSURL!#>, response: <#NSURLResponse!#>, error: <#NSError!#>) -> Void in
Why?
Something such as <#NSURL!#>
as it's invalid syntax and not a valid type, instead you want the the following.
(loction: NSURL!, response: NSURLResponse!, error: NSError!) -> Void in
Happy coding!
![Asim Zaidi](https://secure.gravatar.com/avatar/45d60ca0bf0410bc418229687b085d7a?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Asim Zaidi
2,222 Pointsthat worked! thanks