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!
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
Joe Hernandez5,699 Points
found nil while unwrapping an Optional value when using current location, but if I enter in coordinates it works perfect
I get an fatal error: found nil while unwrapping an Optional value when using current location, but if I enter in coordinates it works perfectly.
Max Hirsh16,773 Points
The way I dealt with this in my code was to use "if let" unwrapping for the location with default location information available in case the location data was nil. I'm not sure if it's the best app design, since users would get weather info for say Portland, Oregon until the location manager picked up a location, but it definitely got the app to work.