即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。
当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。
即使接口生成器是一个MyClass,我得到一个错误时启动应用程序。
当MyClass是库的一部分时,就会发生这种情况,如果直接在应用程序目标中编译该类则不会发生这种情况。
当前回答
在我的例子中,问题是一个死的IBOutlet链接。一旦这个问题解决了,一切又恢复了正常。
其他回答
这是一个Xcode4缓存问题,删除所有文件夹 /Users/your_user/Library/Application Support/iPhone Simulator/4.3/Applications/
此外,如果你在iPhone上测试时遇到同样的问题,在运行之前删除旧应用程序……
祝你好运。帕斯卡
转到“ProjectName”,点击它,然后进入“Build phases”选项卡,然后点击“compile sources”,然后点击“+”按钮,一个窗口将出现,选择“MyClass”。然后点击“添加”,
建立项目并运行它,问题一定会得到解决
在我的例子中,我删除了一个名为“viewController”的类,没有意识到它是用故事板的身份检查器选中的(在顶部的“自定义类”下)。
你只需要在你的身份检查器的自定义类字段中为视图控制器选择正确的类,或者添加一个新类到你的项目中,并选择它作为你的自定义类。
为我工作!
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)
当我制作了一个同名的新项目并在模拟器中运行它们时,我就遇到了这个问题。我重命名了其中一个项目,在模拟器中删除了应用程序,然后重新运行并重新构建。