我在Xcode上得到一个错误说没有关于视图控制器的信息。

无法插入新的出口连接:无法找到所命名类的任何信息

为什么会这样?


当前回答

在我的情况下,这是bc,我在IB中选择了一个新的UIViewController文件,然后尝试按住鼠标拖动到这个新控制器,而不首先删除连接检查器中的先前连接。先删除这些,然后再试一次。

其他回答

请只执行以下两个步骤以消除此错误。

1.  Clean Project using Product -> clean.
2.  Run the Project.

现在尝试添加/连接操作或出口。

工作很好,我很多次。

我通过编程方式创建标签和文本字段,然后从代码左侧的小空圆圈中command - drag到Storyboard上的组件,从而解决了这个问题。为了说明我的观点:我写了@IBOutlet weak var HelloLabel: UILabel!,然后按Command并将代码拖到故事板上的组件中。

当我重命名类时,我得到了这个bug。然后我按照下面的步骤解决了这个问题

在Xcode菜单->产品->清洁 重新启动Xcode

以下是一些可以解决这个问题的方法(难度依次递增):

Clean the project (Product > Clean) Manually paste in @IBOutlet weak var viewName: UIView! // or @IBAction func viewTapped(_ sender: Any) { } and control drag to it. (Change type as needed.) Also see this. Completely close Xcode and restart your project. Delete the Derived Data folder (Go to Xcode > Preferences > Locations and click the gray arrow by the Derived Data folder. Then delete your project folder.) Click delete on the class, remove reference (not Move to Trash), and add it back again. (see this answer)

我使用的是xCode 7和iOS 9。

在你的。m

#导入“VC.h”

保存.m并再次链接您的outlet,它可以正常工作。

在你的。m

#导入“VC.h”

保存打烊