本文介绍了Xcode 6 错误:Interface Builder 文件中的未知类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I upgraded to Xcode 6 beta 4 and now my App continuously crashes with the message

Interface Builder 文件中的未知类 X.

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

It crashes because supposedly Xcode can't find my custom classes that I have linked in my Storyboard but it shows that they are linked correctly in the Xcode interface.

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

I'm positive everything is linked correctly. My only other option may be to delete the entire storyboard file and start from scratch because it might be corrupted somehow.

我还想补充一点,我尝试过清理、重置模拟器、搞乱构建阶段等.这些都不起作用.

I would also like to add that I tried cleaning, reseting simulator, messing with build phases etc. None of that works.

推荐答案

我在输入问题时解决了这个问题.我想我会回答我的问题并将其留在这里给在使用 Xcode 6 beta 4 时可能遇到此问题的任何其他人.

I resolved this issue as I was typing the question. I figured I'd answer my question and leave it here for anyone else who may face this issue when using Xcode 6 beta 4.

要解决此问题,您需要在 Storyboard 中选择每个自定义类对象(这包括任何自定义视图,甚至自定义视图控制器本身).

To resolve this issue, you need to select each of your custom class objects in Storyboard (this includes any custom views, even the custom view controllers themselves).

然后选择这些对象,打开身份检查器,在自定义类"下,您应该看到模块选项.在模块"文本框内单击,然后按 Enter.

Then with those objects selected, open the identity inspector and under "Custom Class" you should see the Module option. Click inside the Module text box, and press enter.

就是这样!在 Xcode 6 beta 4 中,我的所有自定义对象的当前模块必须在内部以某种方式错误地设置.但在检查器中没有视觉指示.

That's it! The current module for all of my custom objects must have been internally incorrectly set somehow in Xcode 6 beta 4. But there was no visual indication of this in the inspector.

请注意,如果在 Module 文本框中按 Enter 键不起作用,请尝试选择右侧的箭头并手动选择您当前的模块,然后清除文本框并按 Enter.您也可以尝试在类文本框中按 Enter 键(尽管这通常是为了解决不同的问题).

Note that if pressing enter inside the Module text box doesn't work, try selecting the arrow to the right and manually select your current module, then clear the text box and press enter. You can also try pressing enter inside the class text box (although this usually is to resolve a different issue).

这是一张让事情更清楚的图片:

Here is an image to make things more clear:

这篇关于Xcode 6 错误:Interface Builder 文件中的未知类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 07:20