1

I guess every Swift developer gets this error every once in a while: fatal error: unexpectedly found nil while unwrapping an Optional value

I know that force unwrapping an optional without a value causes this to happen (it mostly happens to me when I'm messing with storyboard connections).

I just came across a video on Youtube about this error, and when the developer in the video demonstrated what causes the error, he was pointed directly to the piece of code that causes the error. When I get this error, all I see is Assembly language and no hint whatsoever as to what causes the problem. No breakpoint in my Swift code, no key that couldn't be found, no nothing. This happens on all Macs that I use - my private MacBook and my Mac Mini at the office.

My question is: why does this happen?

Edit: here's a screenshot of what happens.

This is what happens

Mark
  • 1,258
  • 13
  • 25

1 Answers1

0

You need to click on the Debug Navigator button (Cmd-6)

enter image description here.

This should show you the backtrace, and the actual line of code that's in error.

Ashley Mills
  • 50,474
  • 16
  • 129
  • 160