即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。
当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。
即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。
当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。
当前回答
我有“Interface Builder file中的未知类favoritesbutton”,并将其追踪到一个故事书场景,其中有问题的按钮在身份检查器顶部的class字段中有一个伪自定义类“favoritesbutton”。我想把这个值放在下一个字段:Identity Label。
将其更改为“UIButton”解决了这个问题。
其他回答
在尝试了这里的大多数建议都没有成功之后,我只是重命名了我的类,然后在xib文件中手动重命名它(源代码是开放的)。问题就这样解决了。
这与Interface Builder没有任何关系,这里发生的是符号没有被Xcode从静态库中加载。要解决这个问题,你需要将-all_load -ObjC标记添加到项目(可能是目标)构建设置的其他链接器标记键。
由于Objective-C每个类只生成一个符号,我们必须通过使用-ObjC标志强制链接器加载类的成员,我们还必须通过添加-all_load链接器标志强制包含静态库中的所有对象。如果你跳过这些标志,你迟早会遇到无法识别的选择器错误,或者得到其他异常,就像你在这里观察到的一样。
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)
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.
从接口生成器/故事板被引用到一个不可用的类。
如果是已知类,则没有链接。
如果不是一个类,或者只是一些字符,则可能是打字错误。 在这种情况下,检查视图控制器中这个'unknown class'的所有字段。 在“身份检查器”中(块“自定义类”左起第三个)是一个字段 '类',其中可能包含错误的值。通常它会列出字段类型 (UIView / UILabel等)。