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

其他回答

发生这种情况是因为.xib有一个陈旧的链接到旧的应用程序委托,它不再存在了。 我是这样修改的:

右键单击.xib并选择“打开为>源代码” 在这个文件中,搜索旧的App委托并将其替换为新的委托

我沿着劳拉建议的路线修复了这个问题,但我不需要重新创建文件。

使用XCode 4,在Project Navigator中,选择包含它要抱怨的类的.m文件 点击查看->实用工具->显示文件检查器(这将显示文件检查器在右边,带有。m- File信息) 打开Target Membership部分,并确保为这个.m文件选择了目标

当我把我的.m文件添加到我的项目时,由于某种原因,它没有把它添加到我的默认目标中,这导致我得到你提到的错误。

我试过这个,还有这个网站上列出的其他答案,没有一个能帮我理清头绪。以下评论(来自http://www.iphonedevsdk.com/forum/iphone-sdk-development/43330-unknown-class-interface-builder-file.html)有助于:

在搜索、搜索、搜索之后,我终于发现了这个被删除的类的名称隐藏在一个文件中。我必须在X-code中打开界面构建器文件,右键单击它们并选择“查看源代码”。然后我找到了 <object class="NSMutableArray" key="dict.values"> < bool关键= " EncodedWithXMLCoder " >对< / bool > <字符串> com.apple.InterfaceBuilder。IBCocoaTouchP lu gin</string> 这是类名*</string>

不幸的是,简单地删除最后一行并不能解决这个问题,它会抱怨文件中有错误的项数。您需要在它上面的行部分中删除对应的行,它引用CustomClass。

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.

我有“Interface Builder file中的未知类favoritesbutton”,并将其追踪到一个故事书场景,其中有问题的按钮在身份检查器顶部的class字段中有一个伪自定义类“favoritesbutton”。我想把这个值放在下一个字段:Identity Label。

将其更改为“UIButton”解决了这个问题。