简体   繁体   English

XCode 6.3错误:Interface Builder文件中的未知类

[英]XCode 6.3 bug: Unknown class in Interface Builder file

I am working with XCode 6.3 & Swift. 我正在使用XCode 6.3和Swift。

I have just added a few view controllers in my storyboard & added the custom classes & set the respective custom classes in identity inspector. 我刚刚在情节提要中添加了一些视图控制器,并添加了自定义类并在身份检查器中设置了相应的自定义类。

在此处输入图片说明

But while I run the app it shows Unknown class X in Interface Builder file. 但是,当我运行该应用程序时,它在Interface Builder文件中显示了Unknown classX。 & I am not able to interact with my custom classes. &我无法与自定义类进行交互。 There are few similar questions like this & I have tried all the solutions but none of them are working for me. 类似这样的问题很少,我已经尝试了所有解决方案,但没有一个对我有用。

Sometimes Xcode missed customModule="AppName" customModuleProvider="target" 有时Xcode错过了customModule =“ AppName” customModuleProvider =“ target”

To fix it, open storyboard as source code and replace this line: 要修复此问题,请打开情节提要作为源代码并替换以下行:

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

to this: 对此:

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

All my viewControllers were ok, but I searched through he whole storyboard file and found this: 我所有的viewController都还可以,但是我在他的整个故事板文件中进行了搜索,发现:

<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC" customClass="end">

Removing the custom class got rid of the error: 删除自定义类摆脱了错误:

<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">

No idea why this custom class was there in the first place. 不知道为什么这个自定义类首先出现在这里。

I restarted my Macbook and all modules started to populate in the Custom Class box. 我重新启动了Macbook,所有模块开始在“自定义类别”框中填充。 No created classes were showing in the dropdown box. 下拉框中没有显示创建的类。

I'm on Xcode 7.0.1, OSX 10.10.5 on a 2015 Macbook Pro. 我在2015 Macbook Pro上使用Xcode 7.0.1,OSX 10.10.5。 That was a really annoying error to figure out. 要弄清楚,这真是一个令人讨厌的错误。

It may seem like a tedious thing but make sure that everywhere you have referenced the view controller it has been spelled correctly. 看起来似乎很乏味,但是请确保在引用了视图控制器的所有地方,其拼写都正确。 I regrettably spent a lot of time attempting all of the suggestions to fix the error and it turned out to be a simple spelling mistake! 遗憾的是,我花了很多时间尝试所有建议以解决该错误,结果证明这是一个简单的拼写错误!

Before: 之前:

UIViewController *myViewController = [[FormApplicationViewController alloc] initWithNibName:@"FormApplicationviewController" bundle:nil];

After: 后:

UIViewController *myViewController = [[FormApplicationViewController alloc] initWithNibName:@"FormApplicationViewController" bundle:nil];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM