1

I have recently encountered a weird error, every time I try to run the code I get

Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value

which I find really weird as I have never encountered this error before on the same project. But no errors are shown in build time only run time. Please Help Me!!!!! The biID element is set via a Outlet connected to the main storyboard. In the main storyboard the label is empty.

Like This:

@IBOutlet weak var biID: UILabel!

Picture of the error:

enter image description here

  • Most likely biID is nil. Print it out and see. Maybe you have a messed up outlet? – Nate Dec 01 '18 at 03:41
  • Yes the outlet is nil, but I do not know how to fix it. I am new to Xcode so sorry if this question is weird! – Ambrose Yeung Dec 01 '18 at 04:08
  • So that’s your problem. Nil does not have a property called text, so you get a crash. Currently, you haven’t shown us how biID gets set, so we really can’t help you further. Could you update your question and show us the code where biID gets set? Also, please add it as text instead of a picture. It makes things easier and also searchable. – Nate Dec 01 '18 at 04:11
  • Alright, I have made some improvements to my post according to your suggestions, feel free to make more suggestions. – Ambrose Yeung Dec 01 '18 at 04:25
  • Check if this helps. https://stackoverflow.com/questions/29321383/iboutlet-is-nil-but-it-is-connected-in-storyboard-swift – Rakesha Shastri Dec 01 '18 at 04:32
  • Hi, I have read the link you gave me, I am really new to Xcode so I have some trouble understanding it – Ambrose Yeung Dec 01 '18 at 04:41

0 Answers0