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:43

Project with Multiple Targets

In my case I am working on Project with multiple Targets and the issue was "inherit from Target" was unchecked. Selecting "inherit from target" solved my problem

enter image description here

查看更多
心情的温度
3楼-- · 2018-12-31 16:43

I fixed it by doing exactly the opposite of what ChikabuZ suggested (thanks for pointing it out, though). In the storyboard file, find this:

<viewController storyboardIdentifier="StoryboardId" id="SomeID" customClass="CustomClass" customModule="AppName" customModuleProvider="target" sceneMemberID="viewController">

and replace it with this:

<viewController storyboardIdentifier="StoryboardId" id="SomeID" customClass="CustomClass" sceneMemberID="viewController">

I can't believe how many hours I'm losing getting around bugs in the Swift compiler and Xcode 6

查看更多
人气声优
4楼-- · 2018-12-31 16:46

I solved this problem by typing in the Module name (unfortunately the drop list will show nothing...) in the Custom Class of the identity inspector for all the View controller and views.

You may also need to indicate the target provider. To achieve this objective you can open the storyboard in sourcecode mode and add the "customModuleProvider" attribute in both ViewController and View angle brackets.

查看更多
一个人的天荒地老
5楼-- · 2018-12-31 16:46

My solution (Xcode 8.1 Swift 3.0):

Unknown class xxx in Interface Builder file.

Open StoryBoard as Source Code and search for xxx. Remove attribute which contains value xxx. Build and Run.

查看更多
君临天下
6楼-- · 2018-12-31 16:47

I faced this issue in Xcode 6.1 when I removed Main.storyboard , the LaunchScreen.xib file and the default ViewController classes from my project.

I fixed it by deleting the Launch Screen File and Main Interface entries from Info.plist

查看更多
爱死公子算了
7楼-- · 2018-12-31 16:48

I solved this by opening my storyboard file as source code and using command-F to search for my unknown class and delete the custom class associated with it.

查看更多
登录 后发表回答