美文网首页
Unknown class X in Interface Bui

Unknown class X in Interface Bui

作者: 公爵海恩庭斯 | 来源:发表于2016-04-27 15:04 被阅读825次

    我在将 Objective-C 代码迁移至 Swift 时遇到的这个问题。storyborad 中,有几个 label 的 Custom Class 是 SpFontsLabel,而我将 SpFontsLabel 替换成 Swift 实现后,运行时遇到如下错误:

    2016-04-27 14:34:55.130 club[17371:153704] Unknown class SpFontsLabel in Interface Builder file.
    2016-04-27 14:34:55.130 club[17371:153704] Unknown class SpFontsLabel in Interface Builder file.
    2016-04-27 14:34:55.131 club[17371:153704] Unknown class SpFontsLabel in Interface Builder file.
    2016-04-27 14:34:55.131 club[17371:153704] Unknown class SpFontsLabel in Interface Builder file.
    2016-04-27 14:34:55.131 club[17371:153704] Unknown class SpFontsLabel in Interface Builder file.
    2016-04-27 14:34:55.132 club[17371:153704] Unknown class SpFontsLabel in Interface Builder file.
    2016-04-27 14:34:55.133 club[17371:153704] Unknown class SpFontsLabel in Interface Builder file.
    

    解决方法是在 storyborad 中每一个设定 Custom Class 的地方,将 Module 从 None 改成当前工程的 Module。

    重新设定 Module

    参考 Xcode 6 Strange Bug: Unknown class in Interface Builder file

    相关文章

      网友评论

          本文标题:Unknown class X in Interface Bui

          本文链接:https://www.haomeiwen.com/subject/uwycrttx.html