In my case this was bc I chose a new UIViewController file in IB and then tried to ctrl-drag to this new controller without first removing the previous connections in the Connections Inspector. Remove those first and try again.
Or if none of the above works, type out the name of the outlet into the file first @IBOutlet weak var headerHeightConstraint: NSLayoutConstraint! and then click and drag from the outlet in the nib to the variable you just programmatically created. It should work without any of the hassle of cleaning, building, and deleting anything.
None of the tips in the best answer worked for me. Was going crazy. Then noticed that the Assistant Editor had somehow gotten set to Manual and I was on the ViewController.swift (Interface) instead of the ViewController.swift file.
Changed that and problem solved. A bit embarrassing but hey, we are all learning.
In my case this was bc I chose a new UIViewController file in IB and then tried to ctrl-drag to this new controller without first removing the previous connections in the Connections Inspector. Remove those first and try again.
Or if none of the above works, type out the name of the outlet into the file first
@IBOutlet weak var headerHeightConstraint: NSLayoutConstraint!
and then click and drag from the outlet in the nib to the variable you just programmatically created. It should work without any of the hassle of cleaning, building, and deleting anything.I had the same issue. I tired below solutions but didn’t worked :
Clean Project (cmd + shift + k)
and evenClean Project Build (cmd + shift + alt + k)
Deleted Derived data
andModule Cache content
Below workaround to this issue :
IBOutlet / IBAction
manually (copy paste preferred)Utilites
windowConnection Inspector
IBOutlet
andIBAction
written in source file with Interface Builder.Simplest solution:- I used xCode 7 and iOS 9.
in your .m
delete #import "VC.h"
save .m and link your outlet again it work fine.
None of the tips in the best answer worked for me. Was going crazy. Then noticed that the Assistant Editor had somehow gotten set to Manual and I was on the ViewController.swift (Interface) instead of the ViewController.swift file.
Changed that and problem solved. A bit embarrassing but hey, we are all learning.
Here are the steps solved for me:
Done !