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

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


当前回答

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

其他回答

如果你有多个StoryBoard并且其中一个StoryBoard使用的是不存在的,那么这个“Interface Builder file中的Unknown class”错误就会在运行时出现。

不仅在项目设置中,在目标设置中也必须添加-all_load -ObjC标志。

Core-Plot: Interface Builder文件中的未知类CPLayerHostingView

当我添加一个选择器视图,然后删除它时,这个问题发生在我身上。如果它能帮助到别人,下面是我最终解决它的方法:

在XCODE打开文档大纲(不知道什么是文档大纲?我也没有-谷歌..:))。 在文档大纲窗口中找到使警告消息出现的场景。 在有问题的场景中,站在View上(点击),然后在Utility(谷歌it)窗口中选择Identity inspector选项卡,将自定义类名更改回默认的UIView。

不。:)

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

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

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

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.