Xcode 6 Bug: Unknown class in Interface Builder fi

2018-12-31 16:33发布

I upgraded to Xcode 6 beta 4 and now my App continuously crashes with the message

Unknown class X in Interface Builder file.

It crashes because supposedly Xcode can't find my custom classes that I have linked in my Storyboard but it shows that they are linked correctly in the Xcode interface.

I'm positive everything is linked correctly. My only other option may be to delete the entire storyboard file and start from scratch because it might be corrupted somehow.

Edit: I would also like to add that I tried cleaning, reseting simulator, messing with build phases etc. None of that works.

30条回答
与风俱净
2楼-- · 2018-12-31 16:55

I had the same problem.

In my case, Xcode wasn't adding my custom class to: Target > Build Phase > Compile Sources.

So I recommend you to verify if your CustomClass.m is there.

enter image description here

I hope this helps you.

查看更多
孤独寂梦人
3楼-- · 2018-12-31 16:55

Select your unknown class file, open file inspector tab, check your target name in Target Membership. There you go.

查看更多
春风洒进眼中
4楼-- · 2018-12-31 16:56

I googled everywhere for this. None of the answers work for me until i met 1 dude who asked me to move my project folder to desktop. It just worked automatically. Apparently if you have you project folder to deep in many folders, XCODE actually breaks.

查看更多
时光乱了年华
5楼-- · 2018-12-31 16:57

I had this problem after renaming a swift class. Solved it by using the @objc directive:

@objc(ForumTopicListViewController) class ForumTopicListViewController
查看更多
谁念西风独自凉
6楼-- · 2018-12-31 16:58

In my case, I added a flag -ObjC to Other Linker Flags in project settings to make it work. Also I tried with -all_load flag and it worked well too.

enter image description here

查看更多
公子世无双
7楼-- · 2018-12-31 16:58

I had this problem after I added a new target, then created a new class using the 'New File' dialog but accidentally failed to check the new target as well as the original target in the creation dialog, so the object was only added to my original target. The solution was to delete the source files (remove reference only) then add them back using 'Add Files', this time checking both targets.

查看更多
登录 后发表回答