Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode crashes when I try to drag and drop an IB Outlet

When I try to drag and drop an IB outlet from a UIView into my ViewController.swift, XCode crashes (when I press OK after typing a name for the IBOutlet). A popup appears saying: "XCode quit unexpectedly": Ignore, report, reopen. The report says lots of verbose, the most notable warnings are these:

UNCAUGHT EXCEPTION (NSInvalidArgumentException): +[IDESwiftSourceCodeGenerator isTeardownCounterpart:]: unrecognized selector sent to class 0x1159415c0
prepareToAddSourceCodeForCounterparts:documentLocationForCounterpartBlock:addSourceCodeForCounterpartBlock:options:error:] (in IDEKit)
  8  0x000000011588a13f -[IDESwiftSourceCodeGenerator prepareToAddPropertyWithName:type:inClassItem:options:error:] (in IDELanguageSupportUI)

I have other IBOutlets working well for UILabels and a Table View, so I do not understand, why this happens.

I am fairly new to Xcode, if you need any additional info to detect what is going wrong, I will gladly provide it. Already tried the usual Clean, Rebuild, Reopen, Restart, and Simulator reset just in case....

like image 363
Josh Avatar asked May 18 '15 09:05

Josh


1 Answers

Ok, I tried different ways towards desired purpose. I discovered an esoteric workaround:

1-Type this in the .swift file:

@IBOutlet var tableView: UITableView!

2-Do the drag and drop FROM the line of code above TO the UIView in the story board, NOT the other way around, otherwise: XCode will crash.

3-Voila! Bug evaded.

like image 57
Josh Avatar answered Oct 19 '22 04:10

Josh