Unknown class in Interface Builder file [duplicate]

谁都会走 提交于 2019-12-09 08:44:12

问题


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?


回答1:


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?




回答2:


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.




回答3:


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'.




回答4:


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 the Target 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.




回答5:


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.




回答6:


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.




回答7:


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.




回答8:


In case you are using Cocoa pods, drag the .framework/.a files to your projects' "link binary with libraries" section.



来源:https://stackoverflow.com/questions/3416269/unknown-class-in-interface-builder-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!