Xcode 6 Bug:Interface Builder 文件中的未知类

人气:746 发布:2022-10-16 标签: ios xcode interface-builder uistoryboard xcode6

问题描述

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

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

Interface Builder 文件中的未知类 X.

Unknown class X in Interface Builder file.

它崩溃是因为 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).

然后选择这些对象,打开身份检查器并在自定义类"下看到模块"选项.在 Module 文本框内单击,然后按 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:

126