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

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


当前回答

在我的例子中,问题是一个死的IBOutlet链接。一旦这个问题解决了,一切又恢复了正常。

其他回答

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

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

每个苹果文档

对于64位和iPhone操作系统应用程序,有一个链接器错误 阻止-ObjC从静态库中加载对象文件 只包含类别,不包含类。解决方法是使用 -all_load或-force_load标志。

简而言之,在你的“构建设置”中添加-all_load到“其他链接器”标志,你应该没问题。

http://developer.apple.com/library/mac/qa/qa1490/_index.html

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

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

祝你好运。帕斯卡

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.

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