Interface Builder 文件中的未知类
我创建了一个相当简单的 iPhone 应用程序。然后我想创建一个 iPad 版本(通用)的应用程序。尝试使用“升级”选项,但没有成功。因此,我创建了一个单独的通用应用程序,并将 xib 文件复制到我的项目中。这也没有解决,所以我删除了 xib 文件(及其关联的 .m 和 .h 文件)。
现在,当我运行 iPhone 版本时,它在 Interface Builder 文件中给出了 Unknown 类 iPadSample1AppDelegate 。错误和 UISplitViewController 是仅在 UIUserInterfaceIdiomPad 下运行时受支持,然后它退出。因此,我恢复了开始 iPad 冒险之前拍摄的快照...我尝试了 XCode 搜索和 Spotlight 搜索。我的项目中没有对该类或 UISplitViewController 的引用,但由于某种原因,XCode 认为
有某种方法可以删除不存在的引用? LOL
更新:
它可能与我的 XCode 环境有关。在这里找到其他一些帖子后,我尝试了 Clean All / Build / Touch,当我进行触摸时,我在 XCode 中收到以下错误:
未捕获的异常:
-[XCBuildLogWarningMessage setFileLocations:]:无法识别的选择器发送到实例 0x2014dd0a0
无论如何要重新安装 XCode 而不弄乱其他一切?
I created a fairly simple iPhone app. Then figured I'd create an iPad version (Universal) of the app. Tried using the 'upgrade' option and that didn't work-out. So I created a separate universal app and copied the xib files into my project. That didn't work out either, so I deleted the xib files (and their associated .m & .h files.
Now, when I run the iPhone version it gives me the Unknown class iPadSample1AppDelegate in Interface Builder file. error and UISplitViewController is only supported when running under UIUserInterfaceIdiomPad and then it exits. So, I restored to the snap-shot I took before embarking on the iPad adventure... I get the same error. I've tried the XCode search and Spotlight search. There is no reference to that class or the UISplitViewController anywhere in my project, but for some reason XCode thinks that there is.
Is there some way to remove a reference that doesn't exist? LOL
Update:
It may have something to do with my XCode environment being jacked. After finding a few other posts on here, I tried a Clean All / Build / Touch and when I did the touch, I got the following error in XCode:
Uncaught Exception:
-[XCBuildLogWarningMessage setFileLocations:]: unrecognized selector sent to instance 0x2014dd0a0
Anyway to reinstall XCode without messing up everything else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
事实证明,iPhone 模拟器上的位与 XCode 不同步。我做了“重置内容和设置”,一切正常:)谁知道呢?
It turns out the bits on the iPhone simulator were out of sync with XCode. I did a 'Reset Content and Settings' and everything works :) Who knew?
如果您进入目标内的“构建阶段”,您将看到“编译源”。确保列出了您需要的每个 m 文件。如果没有,只需将其添加到此处,警告就会消失。
If you go to Build Phases within your targets you will see Compile Sources. Make sure each of the m files you need are listed. If not, just add it here and the warning should go away.
我做了一些研究,发现
适合我的情况
我只需要右键单击项目导航器中的投诉文件。
选择
查看/实用程序/显示文件检查器。
由于某种原因,未选择目标成员身份
。这就是为什么链接器说它不知道该类的存在。
我只是勾选了它,一切都很顺利。
I did some research and found out that
for my case
I just need to right click to complaining file in the Project Navigator.
Choose
View/Utilities/Show File Inspector.
And for some reason theTarget Membership
was not selected.That's why the linker says that it doesn't know the existence of the class.
I just ticked to choose it and everything works like a charm.
右键单击情节提要 -->打开为 -->源代码
在故事板源文件中查找未知的类名。这可能是因为您不小心为 UIView 子类之一分配了自定义类名称。
Right click on Storyboard --> Open As --> Source Code
Find your unknown class name in the storyboard source file. It may be because you have accidentally assigned a custom class name for one of your UIView subclass'.
我遇到了同样的问题,但上面的解决方案没有解决它。我最终通过从 info.plist 文件中删除“主情节提要文件基本名称(iPad)”条目来使其正常工作。
I had this same problem but it was not solved by the solution above. I ended up getting it working by removing the "Main storyboard file base name (iPad)" entry from my info.plist file.
对我来说解决这个问题的方法并不是简单地“删除”模拟器中的 AP,然后再次重建。
也许这个类仍然在 iPhone 模拟器的本地设置中被重新使用。
what fixed it for me was t smply "delete" the ap in the simulator, and rebuild again.
Probably this class was still rerenced in local settings in the iphone simulator.
就我而言,此错误是在重构类名后出现的。不知何故,.xib 文件中的类名没有更改。我在 Textedit 中打开这个 xib 文件并将所有 OldClassVC 替换为 NewClassVC。然后我在新构建之前保存了 xib 文件和清理的项目。项目运行良好。
In my case this error appeared after refactoring class name. Somehow the classname not changed in the .xib file. I opened this xib-file in Textedit and replace all OldClassVC to NewClassVC. Then I saved xib-file and Cleaned project before new build. Project runs well.
如果您使用 Cocoa pod,请将 .framework/.a 文件拖到项目的“将二进制文件与库链接”部分。
In case you are using Cocoa pods, drag the .framework/.a files to your projects' "link binary with libraries" section.