0

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

Jake
  • 13,097
  • 9
  • 44
  • 73
Enzo
  • 73
  • 2
  • 9
  • 1
    Have you tried cleaning the build folder? And restarting Xcode :) – heyfrank Jan 31 '18 at 14:46
  • 1
    try to remove connection(outlet) and connect again – iamalizade Jan 31 '18 at 14:52
  • The console should say more, are sure it doesn't say something like "Found unexpected nil while unwrapping an optional"? – EmilioPelaez Jan 31 '18 at 14:56
  • Thanks for answering. I already tried restart Xcode, clear the project, connect the uitextView again and delete the UITextView and connect it again. No success. – Enzo Jan 31 '18 at 14:59
  • Emilio, all the console shows is "libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) " – Enzo Jan 31 '18 at 14:59
  • @Enzo Your IBOutlets on UITableViewCell or UIViewController? – Maxim Zakopaylov Jan 31 '18 at 15:21
  • Maxim Zakopaylov, the IBOutlets is on UITableViewCell. The table is embedded in a Container View, on a View Controler. Each cell has one or two @IBOutlets but just UITextView is causing problem. – Enzo Jan 31 '18 at 15:38
  • @Enzo I think your UItextView is not on UITableViewCell, maybe it's on different view? Can you show screenshot with all storyboard? – Maxim Zakopaylov Feb 01 '18 at 13:25
  • 1
    @MaximZakopaylov, you are correct. The outlets are not connected on UITableViewCell. They are connected ia a UITableViewController. – Enzo Feb 01 '18 at 20:58
  • @Enzo did my hint help you? – Maxim Zakopaylov Feb 05 '18 at 08:45
  • @Maxim Zakopaylov, I solved the problem recreating the Views, but thanks for showing a different approach, this would be my next step – Enzo Feb 06 '18 at 17:44

2 Answers2

4

Remove the connections and reconnect. Check if the class name is the same in the file and in the storyboard.

Artyom Vlasenko
  • 385
  • 3
  • 16
  • Thanks for answering, Artyon. I already tried delete and recreate the connection and didn´t work. Latter, I will check the class name again, but the others IBOutlets is in the same table and does not trigger error. – Enzo Jan 31 '18 at 15:36
  • Hmm, strange, need more information or screenshot. @Enzo – Artyom Vlasenko Feb 01 '18 at 09:42
2

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.

kd02
  • 422
  • 5
  • 14
  • Worked. I deleted the View Controller and the Table View Controller. After that I created all items again:View Controller , Table View Controller, UITextView, UITextField, so on and I did reconnected UITextView and other elements on UITableViewController class. Thank you @kd02 and Thank you to everyone who answered. – Enzo Feb 02 '18 at 11:36