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

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


当前回答

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)

其他回答

删除错误的最好方法是: 1)选择类文件(.m) 2)在“目标会员”下,“勾选”项目名称条目

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

我试过这个,还有这个网站上列出的其他答案,没有一个能帮我理清头绪。以下评论(来自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。

在我的例子中,它显示了一个甚至不存在的类的错误!我怀疑这是故事板文件中被删除的东西。如果你不能识别错误中的类文件,试试这个:

1)用sublime或其他好的编辑器打开你的项目。搜索被引用的类。 2)把上面写的全部去掉

customClass="UnrecognizedClassName"

3)节约。 4)返回xcode并清理项目,现在试着运行它。

为我工作。

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)