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 trialJoe Hernandez
5,699 Pointsfound 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.
1 Answer
Max Hirsh
16,773 PointsThe 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.