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

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


当前回答

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

其他回答

有时IBuilder会错过customModule="AppName" customModuleProvider="target"

要修复它,打开storyboard作为源代码并替换这一行:

<viewController storyboardIdentifier="StoryboardId" id="SomeID" customClass="CustomClass"
sceneMemberID="viewController">

:

<viewController storyboardIdentifier="StoryboardId" id="SomeID" customClass="CustomClass"
 customModule="AppName" customModuleProvider="target" sceneMemberID="viewController">

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.

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

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

不。:)

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

这是一个Xcode4缓存问题,删除所有文件夹 /Users/your_user/Library/Application Support/iPhone Simulator/4.3/Applications/

此外,如果你在iPhone上测试时遇到同样的问题,在运行之前删除旧应用程序……

祝你好运。帕斯卡