即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。
当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。
即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。
当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。
当前回答
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)
其他回答
我在目标中添加了Build Phase文件,问题得到了解决。关于添加文件的步骤,请参阅我的回答:
Apple Mach-O连接器错误(APActivityIcon)
转到“ProjectName”,点击它,然后进入“Build phases”选项卡,然后点击“compile sources”,然后点击“+”按钮,一个窗口将出现,选择“MyClass”。然后点击“添加”,
建立项目并运行它,问题一定会得到解决
这个问题似乎并没有过时。
我在Xcode 8中也遇到了同样的问题,并解决了类似smilebot的问题:
在Xcode中以“源代码”的形式打开故事板文件: 搜索被引用的类&删除整段
customClass = UnrecognizedClassName”
再次以“interfacebuilder - storyboard”的形式打开你的故事板文件,重新构建你的应用程序。
我在《Swift》中遇到过这种情况。
将.xib文件移动到项目的Base中。Lproj文件夹摆脱了这个错误。
我沿着劳拉建议的路线修复了这个问题,但我不需要重新创建文件。
使用XCode 4,在Project Navigator中,选择包含它要抱怨的类的.m文件 点击查看->实用工具->显示文件检查器(这将显示文件检查器在右边,带有。m- File信息) 打开Target Membership部分,并确保为这个.m文件选择了目标
当我把我的.m文件添加到我的项目时,由于某种原因,它没有把它添加到我的默认目标中,这导致我得到你提到的错误。