Search code examples
iosswiftuitextviewiboutletnsexception

Swift 4: @IBOutlet UITextView crash


I use a table view embedded in a view controller. I stored in the table view some items like UITextField, UISlider, and so on. When I connect these items in the class, the app crashes on the UITextView outlet.

@IBOutlet weak var nameProfileTextField: UITextField!
@IBOutlet weak var ageSlider: UISlider!
@IBOutlet weak var descriptionProfileTextView: UITextView! //Crash here!

The error message does not help me. Console only shows the message below with no more details.

terminating with uncaught exception of type NSException

The @IBOutlet connection seems to be ok as the image below shows. enter image description here


Solution

  • Your IBOutlet links from interface builder to the relevant UIViewController seem fine.

    It might be that the IBOutlet on the UIViewController has more than 1 pointer associated to it.

    If you right click on the grey dot on the left of the IBOutlet in the related UIViewController is there only 1 reference?

    e.g.

    enter image description here

    If this doesn't work I would suggest deleting UIViewController in interface builder and starting again.