我升级到Xcode 6 beta 4,现在我的应用程序不断崩溃的消息

接口构建器文件中的未知类X。

它崩溃是因为Xcode找不到我在Storyboard中链接的自定义类,但它显示它们在Xcode界面中正确链接。

我确定一切都连接正确。我唯一的其他选择可能是删除整个故事板文件并从头开始,因为它可能会以某种方式损坏。

编辑:我还想补充说,我尝试了清洁,重置模拟器,搞乱构建阶段等。这些都没用。


当前回答

对我来说,我使用的是Xcode7 + Swift2

通过检查我的代码解决了这个问题,我在我的viewController中有这一行:

 self?.navigationController?.pushViewController(vc, animated: true)

然后我意识到我还没有将navigationController连接到细节页。如果你推送一个带有自定义ID的新ViewController,最好检查一下。

其他回答

我也有同样的问题。

在我的例子中,Xcode没有将我的自定义类添加到:Target > Build Phase > Compile Sources。

所以我建议你验证一下你的CustomClass。M在这里。

我希望这对你有所帮助。

有时Xcode会错过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">

我通过做与ChikabuZ建议完全相反的事情来解决它(尽管感谢你指出了这一点)。在故事板文件中,找到这个:

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

然后用这个替换:

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

我不敢相信我在Swift编译器和Xcode 6中浪费了多少时间

我解决了这个问题,打开我的故事板文件作为源代码,并使用命令f搜索我的未知类,并删除与之相关的自定义类。

我搜遍了所有地方。没有一个答案对我有用,直到我遇到一个人,他让我把我的项目文件夹移动到桌面。它是自动工作的。显然,如果你的项目文件夹在很多文件夹中,XCODE会崩溃。