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

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

Thread 1: EXC_BAD_INSTRUCTION(code= EXC_I386_INVOP, subcode= 0x0

3 Answers

Jayden Spring
Jayden Spring
8,625 Points

You will need to share your project with us to figure out where in your code the application is crashing.

You have a value someone, an optional, which hasn't been instantiated and you are they trying to unwrap it causing the crash.

I managed to solve it on my own. The "@IBOutlet var funFactLabel: UILabel!" was misplaced after the "let factBook = FactBook()" Placing it above the assigned constant fixed the issue. Thanks anyway.

Jayden Spring
Jayden Spring
8,625 Points

For future reference, if you have a question, it is better to post with your code so other students can help you and give accurate answers

will do :D