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

2

7

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....

Excite answered 18/5, 2015 at 9:40 Comment(7)
Your project might be corrupt. I know it's a PITA but it happens sometimes. You might try rebuilding your project from scratch. Also try the drag and drop with someone else's Mac.Kokand
Try dropping to a different line usually to a blank line with no other line in top and bottom of itGore
@zellb Sorry, XCode is still crashingExcite
Unfortunately this is between you and Apple. Stack Overflow is about programming, not about some app that is crashing on your Mac — even, alas, if that app happens to be Xcode.Gallego
The IDE directly affects programming, even, alas, if you have no clue about what the solution is. @GallegoExcite
@Gallego there are 98k posts tagged with Xcode, i guess none of them are relevant then?Battaglia
@BROK3NS0UL How to use Xcode to program, relevant. Xcode is crashing, not relevant (but file a bug with Apple).Gallego
E
17

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.

Excite answered 18/5, 2015 at 14:59 Comment(2)
Thanks, I was having the same issue. Since updating to Xcode 7.3 it is so buggy ....Battaglia
Experiencing this in 9.0.1 as well.Furze
F
0

Continuous crashes for me also on Xcode 9.4.1 and 10_GM - after linking IBOutlet with XIB.
Solution: clean up Derived data /Users/****/Library/Developer/Xcode/DerivedData.
Based on: https://forums.developer.apple.com/thread/76730

Freda answered 26/9, 2018 at 11:0 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.