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

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


当前回答

这里有很多答案,但没有一个是解决方案, 我追踪到storyBoard,控制器有一个无效的自定义类(类不存在后,我重命名它)

其他回答

我在更改类名时看到了这个错误,尽管更新了所有相关的.h和.m。结果,我错过了更新.storyboard文件中的“customClass”值。这样问题就解决了。

在我的例子中,我有XCode6,指定的类.m文件最终在构建阶段的错误位置-它应该在编译源下,但最终在

In my case I got this error because I'd tried to save some work by creating a new project and then deleting several of the source files and copying over the source files of the same name from the working project. I also copied my MainStoryBoard file which was looking for my RootViewController. However, when I had deleted the original RootViewController and then added in the RootViewController from the previous product, evidently the Add Files operation failed to "check" the target box as suggested above. By merely visting all of the newley imported ".m" files and making sure that the target membership box was checked, all was well. I think what was happening was that the storyboard file was looking for a class that had been "excluded" from the link because the target membership was unchecked. Making sure the required files for the target are so designated in the target membership in the file inspector did the trick. Thanks Pat! (see above)

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

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

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

customClass = UnrecognizedClassName”

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

我有“未知类RateView在接口生成器”,其中RateView是UIView的子类。我已经在Storyboard场景中放置了一个UIView,并将自定义类字段更改为RateView。尽管如此,这个错误还是出现了。

为了调试,我将我的类的名称改为RateView2,并将所有引用更改为匹配,除了UIView的自定义类字段。错误消息仍然像以前一样出现,RateView是缺失的类。这确认了错误消息与Custom类字段的值相关。我将这个值更改为RateView2,错误消息更改为“未知类RateView2在接口生成器”。某种程度上的进步。

最后,我在文件检查器中检查源代码文件本身。在那里,我发现源代码文件(我从教程中复制的)与我的Target没有关联。换句话说,它没有目标会员。我选中了使类的源代码文件成为目标应用程序成员的复选框,错误消息消失了。