即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。
当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。
即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。
当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。
当前回答
在我的例子中,我使用了来自另一个项目的故事板。在看了故事板文件xml之后(例如在TextWrangler中),我注意到一个控制器的“customModule”xml属性值是错误的(它仍然引用旧的项目)。手动更改可以解决这个问题。
其他回答
从接口生成器/故事板被引用到一个不可用的类。
如果是已知类,则没有链接。
如果不是一个类,或者只是一些字符,则可能是打字错误。 在这种情况下,检查视图控制器中这个'unknown class'的所有字段。 在“身份检查器”中(块“自定义类”左起第三个)是一个字段 '类',其中可能包含错误的值。通常它会列出字段类型 (UIView / UILabel等)。
删除错误的最好方法是: 1)选择类文件(.m) 2)在“目标会员”下,“勾选”项目名称条目
在我的例子中,这是因为我在.h文件中声明了UITableView单元格的子类的子类(两个子类的声明都在同一个.h文件中),但忘记在.m文件中对第二个子类进行空实现。
不要忘记实现你在.h文件中声明的子类的任何子类!听起来很简单,但很容易忘记,因为如果你在每个.h/中使用一个类,Xcode会为你做这件事。m文件。
我一直有这个错误与WatchKit一遍又一遍,似乎是当有一个用户界面元素没有绑定到代码中的出口。我猜这在WatchKit中是必需的。
class InterfaceController: WKInterfaceController {
@IBOutlet weak var table: WKInterfaceTable!
}
重要提示:只连接最外层的元素。例如,如果你试图为表中的某些东西提供连接,比如行中的标签,你会得到一个编译器错误,说出口是无效的,不能连接到重复的内容。
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)