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

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


当前回答

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

其他回答

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

只需在appdelegate applicatoindidfinishlanching方法的开头添加以下代码,就可以正常工作了

(myclass类);

每个苹果文档

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

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

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

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.

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

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

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