界面构建器中的未知类 [英] Unknown class in interface builder

查看:77
本文介绍了界面构建器中的未知类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有很多关于这个问题的问题,但我已经尝试了大部分问题,试图找出它并没有成功。

I know that there are a lot of questions on this subject but I've tried most of them to try and figure it out with no success.

问题:
起初我无法从助理编辑器中添加我的类,因为自定义类没有提取它。

the problem: at first I couldn't add my class from the assistant editor cause the custom class didn't pick it up.


  1. 我确保调用继承自uiviewcontroller

  2. 我确保将类添加到目标

  3. 我试图删除类文件并重新添加回来

  4. 最后我通过storyboard xml添加了类,它出现了在自定义类中

  1. I made sure the calls inherits from uiviewcontroller
  2. I made sure the class is added to the target
  3. I tried to remove the class file and re-add it back
  4. finally I've added the class through the storyboard xml and it appeared in the custom class

现在我正在尝试将我的按钮,视图等连接到其出口。它们似乎已连接但在运行应用程序并打开该视图控制器时,应用程序崩溃并且调试器打印:
Interface Builder文件中的未知类xxx。

这个类不是关键值btnMenu的编码兼容。

Now I'm trying to connect my buttons, views etc to its outlets. It seems like they are connected but when running the app and opening that view controller the app crashes and the debugger prints: "Unknown class xxx in Interface Builder file." and than "this class is not key value coding-compliant for the key btnMenu."

我检查过:


  1. 正确设置了连接检查器(那里的网点没有错误)

  2. 试图删除派生数据

  3. 清洁项目

  4. 重新安装应用程序

  1. That connection inspector is properly set (no error in the outlets there)
  2. Tried to delete derived data
  3. Clean project
  4. Re-install the app

我甚至尝试重新启动我的Mac,当然也没有成功。

I even tried restarting my mac and of course no success.

有人可以在这里瞎一些吗?
谢谢。

can anyone shad some light here? thanks.

推荐答案

我刚刚使用UIViewController子类(使用Xcode 9 beta 2& Swift 4) )解决方案是勾选'继承自目标',我在IB中设置自定义类。

I just had this happen with a UIViewController subclass (with Xcode 9 beta 2 & Swift 4) and the solution was to tick 'Inherit from Target' where I set the Custom Class in IB.

这篇关于界面构建器中的未知类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆