即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。

当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。


当前回答

I tried most of the solutions you guys suggested above but to no avail. After reading the solution from user776904's I suspected I was having the same issue as I had rebuilt my app from the ground up but copied the xib files from the previous project. I suspected the xib file had a reference to the old project that was causing my error so I simply deleted my mainwindow_ipad.xib file and copied in a new one from a clean new project. This solved it. And I was not game enough to start changing bits of the xib file in its source code.

其他回答

在我的例子中,它显示了一个甚至不存在的类的错误!我怀疑这是故事板文件中被删除的东西。如果你不能识别错误中的类文件,试试这个:

1)用sublime或其他好的编辑器打开你的项目。搜索被引用的类。 2)把上面写的全部去掉

customClass="UnrecognizedClassName"

3)节约。 4)返回xcode并清理项目,现在试着运行它。

为我工作。

在我的例子中,这是因为我在.h文件中声明了UITableView单元格的子类的子类(两个子类的声明都在同一个.h文件中),但忘记在.m文件中对第二个子类进行空实现。

不要忘记实现你在.h文件中声明的子类的任何子类!听起来很简单,但很容易忘记,因为如果你在每个.h/中使用一个类,Xcode会为你做这件事。m文件。

我今天使用Swift确实遇到了这个问题。

我修改了一个类Model.h + Model。m to a Model.swift。 该对象在Interface Builder中使用class = Model。

一旦我替换了对象,类就不能再加载了。

我所要做的就是把IB的课程参考改为:

Class = Model
Module = 

to

Class = Model
Module = <TARGETNAME>

您将在构建设置中找到<TARGETNAME>。它也是在你生成的Swift-Header中出现的名称:

我一直有这个错误与WatchKit一遍又一遍,似乎是当有一个用户界面元素没有绑定到代码中的出口。我猜这在WatchKit中是必需的。

class InterfaceController: WKInterfaceController {
    @IBOutlet weak var table: WKInterfaceTable!
}

重要提示:只连接最外层的元素。例如,如果你试图为表中的某些东西提供连接,比如行中的标签,你会得到一个编译器错误,说出口是无效的,不能连接到重复的内容。

这个问题似乎并没有过时。

我在Xcode 8中也遇到了同样的问题,并解决了类似smilebot的问题:

在Xcode中以“源代码”的形式打开故事板文件: 搜索被引用的类&删除整段

customClass = UnrecognizedClassName”

再次以“interfacebuilder - storyboard”的形式打开你的故事板文件,重新构建你的应用程序。