Could not insert new outlet connection: Could not

2019-01-20 21:33发布

I got an error on Xcode saying that there was no information about the view controller.

Could not insert new outlet connection: Could not find any information for the class named

Why is this happening?

Screenshot 1

19条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-01-20 22:11

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.

查看更多
一夜七次
3楼-- · 2019-01-20 22:12

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.

查看更多
成全新的幸福
4楼-- · 2019-01-20 22:13

I had the same issue. I tired below solutions but didn’t worked :

  1. Clean Project (cmd + shift + k) and even Clean Project Build (cmd + shift + alt + k)
  2. Deleted Derived data and Module Cache content

Below workaround to this issue :

  1. Move to source code file and write the IBOutlet / IBAction manually (copy paste preferred)

Screenshot 1

  1. Then move to Storyboard file and Open Utilites window
  2. Goto Connection Inspector
  3. Then Connect the IBOutlet and IBAction written in source file with Interface Builder.

Screenshot 2

查看更多
地球回转人心会变
5楼-- · 2019-01-20 22:13

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.

查看更多
啃猪蹄的小仙女
6楼-- · 2019-01-20 22:14

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.

enter image description here

查看更多
爷、活的狠高调
7楼-- · 2019-01-20 22:14

Here are the steps solved for me:

  1. Remove Class name reference from View(storyboard/xib) and save;
  2. Add Class name again and save;
  3. Clean and Build;

Done !

查看更多
登录 后发表回答