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 Using Our JSON Data

Brian Cavanaugh
Brian Cavanaugh
3,797 Points

Works with Alcatraz coordinates, but when I change to my hometown coordinates, I get error

So after following along with the videos, I decided instead of getting the JSON data for Alcatraz as used in the videos, I wanted to get the information for my hometown. I went to google maps and copied the lat. and long. and pasted it into my code where the old Alcatraz coordinates were. THATS IT. just a quick swap of the coordinates and now my app crashes. I didn't alter any other code, just new coordinates. when I copy and paste the old Alcatraz coordinates back in and run, everything is fine. It's very strange.

fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)

then xcode highlights the downloadTask block of code.

any ideas? Im very new to coding so little bugs like this confuse me quite a bit.

here's the coordinates im using if anyone needs it for reference: 33.977450, -117.720448

Chris Stromberg
Chris Stromberg
Courses Plus Student 13,389 Points

Do you have a space between the lat and long coordinates? If so delete it.