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

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


当前回答

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

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

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

extension Buttons {
    public typealias MyButton = MyFrameworkButton
}

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

其他回答

我今天在Xcode 4下将我的aaLuminate应用程序转换为Universal时出现了这个错误。 这个应用程序基于实用工具模板,最初是在Xcode 3下构建的。

为了节省时间,我将iPhone主视图和Flipside视图复制到Universal应用程序上的适当名称。我遇到了“Interface Builder file中未知类x”错误。在我的案例中,XIB文件或目标中没有任何内容。

我还复制了aaLuminate-Info。plist文件跨越其他原因-这有一个旧的关键“主nib文件基名”设置为MainWindow。

只要我删除这个关键它修复了问题!

In my case I got this error because I'd tried to save some work by creating a new project and then deleting several of the source files and copying over the source files of the same name from the working project. I also copied my MainStoryBoard file which was looking for my RootViewController. However, when I had deleted the original RootViewController and then added in the RootViewController from the previous product, evidently the Add Files operation failed to "check" the target box as suggested above. By merely visting all of the newley imported ".m" files and making sure that the target membership box was checked, all was well. I think what was happening was that the storyboard file was looking for a class that had been "excluded" from the link because the target membership was unchecked. Making sure the required files for the target are so designated in the target membership in the file inspector did the trick. Thanks Pat! (see above)

在我的例子中,问题是一个死的IBOutlet链接。一旦这个问题解决了,一切又恢复了正常。

我在更改类名时看到了这个错误,尽管更新了所有相关的.h和.m。结果,我错过了更新.storyboard文件中的“customClass”值。这样问题就解决了。

发生这种情况是因为.xib有一个陈旧的链接到旧的应用程序委托,它不再存在了。 我是这样修改的:

右键单击.xib并选择“打开为>源代码” 在这个文件中,搜索旧的App委托并将其替换为新的委托