即使接口生成器是一个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.

其他回答

转到“ProjectName”,点击它,然后进入“Build phases”选项卡,然后点击“compile sources”,然后点击“+”按钮,一个窗口将出现,选择“MyClass”。然后点击“添加”,

建立项目并运行它,问题一定会得到解决

这与Interface Builder没有任何关系,这里发生的是符号没有被Xcode从静态库中加载。要解决这个问题,你需要将-all_load -ObjC标记添加到项目(可能是目标)构建设置的其他链接器标记键。

由于Objective-C每个类只生成一个符号,我们必须通过使用-ObjC标志强制链接器加载类的成员,我们还必须通过添加-all_load链接器标志强制包含静态库中的所有对象。如果你跳过这些标志,你迟早会遇到无法识别的选择器错误,或者得到其他异常,就像你在这里观察到的一样。

在我的情况下,我得到这个错误消息由一个非常愚蠢的错误由我:在接口构建器上,我想设置一个UITableViewCell的标识符,但我意外地键入标识符到'自定义类'的接口构建器条目。

我在....之前制造了1000次细胞

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.

在我的例子中,问题是一个死的IBOutlet链接。一旦这个问题解决了,一切又恢复了正常。