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) Data Modeling With Structures Cleaning Up Our Date

Daniel Hepting
Daniel Hepting
1,803 Points

Getting a fatal Error on "precibProbability = currentWeather..."

I get an error on that line:

    precibProbability = currentWeather ["precibProbability"] as Double

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

I already tried to debug, didn't work, please help

Daniel, hi.

I just caught the same error.

I re-cheked all variables names in struct Current and found few misspells. To get right names I printed out weatherDictionary and compared actual data with my var names. After I fixed misspells all works fine.

As I can see, you have just the same problem. It should be:

precipProbability = currentWeather["precipProbability"] as Double

Hope it will help.

Daniel Hepting
Daniel Hepting
1,803 Points

Thanks! That one space wasn't the fault, but after I rechecked my code four times, I finally found my mistake.

1 Answer

How about posting a solution?