博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Xcode 6 Bug:Interface Builder文件中的未知类
阅读量:2289 次
发布时间:2019-05-09

本文共 3789 字,大约阅读时间需要 12 分钟。

本文翻译自:

I upgraded to Xcode 6 beta 4 and now my App continuously crashes with the message 我升级到Xcode 6 beta 4,现在我的应用程序不断崩溃

Unknown class X in Interface Builder file. Interface Builder文件中的未知类X.

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. 它崩溃了,因为据说Xcode找不到我在Storyboard中链接的自定义类,但它显示它们在Xcode界面中正确链接。

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. 我唯一的另一个选择可能是删除整个故事板文件并从头开始,因为它可能会以某种方式损坏。

Edit: I would also like to add that I tried cleaning, reseting simulator, messing with build phases etc. None of that works. 编辑:我还想补充一点,我尝试清理,重置模拟器,弄乱构建阶段等。这些都不起作用。


#1楼

参考:


#2楼

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. 我想我会回答我的问题,并将其留给其他可能在使用Xcode 6 beta 4时遇到此问题的人。

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). 要解决此问题,您需要在Storyboard中选择每个自定义类对象(这包括任何自定义视图,甚至是自定义视图控制器本身)。

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. 在“模块”文本框内单击,然后按Enter键。

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. 我的所有自定义对象的当前模块必须在Xcode 6 beta 4中以某种方式在内部错误设置。但是在检查器中没有这种可视指示。

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. 请注意,如果在“模块”文本框内按Enter键不起作用,请尝试选择右侧的箭头并手动选择当前模块,然后清除文本框并按Enter键。 You can also try pressing enter inside the class text box (although this usually is to resolve a different issue). 您也可以尝试在类文本框中按Enter键(尽管这通常是为了解决另一个问题)。

Here is an image to make things more clear: 这是一个让事情变得更清晰的图像: 在此输入图像描述


#3楼

What @gfrs said is correct, you need to set the Module. @gfrs说的是正确的,你需要设置模块。 However I once ran into an issue that my class wasn't listed in the Class dropdown. 但是,我曾经遇到过一个问题,即我的课程没有在Class下拉列表中列出。 Eventually I removed the swift file, re-started Xcode and re-created the file. 最后我删除了swift文件,重新启动了Xcode并重新创建了该文件。 Finally the class was listed and could be used in Storyboard. 最后列出了类,可以在Storyboard中使用。

Also have a look at , which looks like to solve the 'real' problem I encountered. 还看看 ,看起来像是解决了我遇到的'真实'问题。


#4楼

What only worked for me is actually adding the module name to the xib file... 实际上只对我有用的是将模块名称添加到xib文件中......

Sooo, the xib files look like this: Sooo,xib文件如下所示:

mymodule.MyViewController.xib (Module being the name of the proyect, usually)

HORRIBLE solution in my opinion, but that is supposedly how Apple wants us to do it now. 在我看来,这是一个可怕的解决方案,但这应该是Apple希望我们现在这样做的方式。

... apparently Apple has not been very helpful in this situation according to some because they call it "Working as intended." ......显然Apple在这种情况下并不是很有帮助,因为他们称之为“按预期工作”。


#5楼

I had this problem after renaming a swift class. 重命名swift类后我遇到了这个问题。 Solved it by using the @objc directive: 使用@objc指令解决了这个问题:

@objc(ForumTopicListViewController) class ForumTopicListViewController

#6楼

I had the same problem with Xcode Version 6.1 (6A1052d). 我对Xcode Version 6.1(6A1052d)也有同样的问题。 I think the problem appears if you renamed your App / Xcode Project. 我认为如果您重命名App / Xcode项目会出现问题。

My solution was to add the module name in the interface builder manually. 我的解决方案是手动在界面构建器中添加模块名称。

转载地址:http://hncnb.baihongyu.com/

你可能感兴趣的文章
一键升级python
查看>>
python 99乘法表
查看>>
一个可以拿来直接用的资产管理项目
查看>>
Centos 7 firewalld 基本操作
查看>>
passwd:只能指定一个用户的名称。
查看>>
nginx日志切割和日志清理
查看>>
RPC与分布式服务框架Dubbo
查看>>
为什么需要文件服务器?
查看>>
Redis怎么实现主从同步的
查看>>
Spring整理
查看>>
Spring Mvc整理
查看>>
Dubbo整理
查看>>
Redis整理
查看>>
JVM内存模型和类加载机制
查看>>
JDK1.0到12各版本新特性
查看>>
JAVA的一次编译,到处运行。可以在所有的平台上运行?
查看>>
HttpSessionListener监听器
查看>>
JSP
查看>>
Servlet九大内置对象
查看>>
JSTL
查看>>