即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。

当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。


当前回答

有时IBuilder会错过customModule="AppName" customModuleProvider="target"

要修复它,打开storyboard作为源代码并替换这一行:

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

:

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

其他回答

I tried most of the solutions you guys suggested above but to no avail. After reading the solution from user776904's I suspected I was having the same issue as I had rebuilt my app from the ground up but copied the xib files from the previous project. I suspected the xib file had a reference to the old project that was causing my error so I simply deleted my mainwindow_ipad.xib file and copied in a new one from a clean new project. This solved it. And I was not game enough to start changing bits of the xib file in its source code.

我在《Swift》中遇到过这种情况。

将.xib文件移动到项目的Base中。Lproj文件夹摆脱了这个错误。

在我的情况下,类不能被找到,因为它是一个类定义在一个框架内的扩展,如下所示:

extension Buttons {
    public class MyButton: UIButton {
        // ...
    }
}

当我从扩展中提取类时,Storyboard最终可以找到类(MyFrameworkButton):

extension Buttons {
    public typealias MyButton = MyFrameworkButton
}

public class MyFrameworkButton: UIButton {
    // ...
}

在我的例子中,它显示了一个甚至不存在的类的错误!我怀疑这是故事板文件中被删除的东西。如果你不能识别错误中的类文件,试试这个:

1)用sublime或其他好的编辑器打开你的项目。搜索被引用的类。 2)把上面写的全部去掉

customClass="UnrecognizedClassName"

3)节约。 4)返回xcode并清理项目,现在试着运行它。

为我工作。

有时IBuilder会错过customModule="AppName" customModuleProvider="target"

要修复它,打开storyboard作为源代码并替换这一行:

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

:

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