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

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


当前回答

我通过从我的class.h和.m复制文本来修复这个问题,从项目中删除这些类文件,并使用“添加文件”创建新的class.h和.m文件。然后我将代码粘贴回新文件中,一切都运行良好。由于某种原因,文件在创建时没有正确链接。在那之后,我不需要使用任何链接标志。

其他回答

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.

在我的例子中,我删除了一个名为“viewController”的类,没有意识到它是用故事板的身份检查器选中的(在顶部的“自定义类”下)。

你只需要在你的身份检查器的自定义类字段中为视图控制器选择正确的类,或者添加一个新类到你的项目中,并选择它作为你的自定义类。

为我工作!

在我的例子中,我使用了来自另一个项目的故事板。在看了故事板文件xml之后(例如在TextWrangler中),我注意到一个控制器的“customModule”xml属性值是错误的(它仍然引用旧的项目)。手动更改可以解决这个问题。

只需删除MyClass。M和。h,并将它们再次添加到项目是我的工作。

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

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

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

customClass = UnrecognizedClassName”

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