If you get this error ...
unexpectedly found nil while unwrapping an Optional value
... somewhere in your code, you force the Optional value to be expanded using ! . There is no other reason why this error message will be presented.
One common cause of this error is @IBOutlet declared with ! but incorrectly connected in Interface Builder. I would disconnect and reconnect all @IBOutlet in your project to make sure they are connected correctly.
Other than that, go through each line of code where you use ! to force to expand something and deploy it manually using if let or guard let , or at least set a breakpoint so that you can narrow down, which is forcibly expanded further, causes an error.
There is a reason why ! sometimes called "punch!". It makes things explode. And headaches. A lot of headaches.
source share