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 with Swift (Retired) Concurrency Writing Concurrent Networking Code

Jeanne Merle
Jeanne Merle
3,390 Points

Expected ',' separator : weird error

Hi,

I'm stuck, my Xcode wants me to add extra ',' after 'location:' 'response:' and 'error:' It says : "Fix It Insert ',' "

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

Of course that would not make sens to have this : location:, <#NSURL!#>, response:, <#NSURLResponse!#>, error:, <#NSError!#>

and if I still do so, the message is still the same "Expected ',' separator" if I simply follow the advices, I have 2 comas after each parameter : location:,,

and the message become "Unexpected separator ',' Fix It Delete ',' " I see no solution to this problem ... Can somebody help me ? Thanks a lot

Jiri Stepanek
Jiri Stepanek
10,740 Points

Yea xcode is doing this sometimes also with ";". Mostly I just ignore it and rework my code. I think you should delete those hashtags and <>. It worked 4 me

1 Answer

Jeanne Merle
Jeanne Merle
3,390 Points

I have deleted the NSURL! automatically provided by XCode and typed again "NSURL!" , and did as well for the 2 other parameters and now there is no more errors. Thanks for the advice Jiri !

PS : the <# #> where automatically added when I copied-pasted my code into this message. I have not added them on my own.

Had the exact same issue. Fixed now.

Brice Amram
Brice Amram
2,937 Points

And... same here ! Jiri a lot of thanks too from here, in Paris, FR : )