[ios] Xcode 6 Bug: Unknown class in Interface Builder file

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.

This question is related to ios xcode xcode6 interface-builder uistoryboard

The answer is


I faced this problem in Xcode 8, to resolve it I had to modify storyboard in the text editor.

In general, look up for your control and remove customModule and customModuleProvider from control entity.

Did a trick for me.


On me it happend because my project was called with "ä,ü,ö"


I faced such a problem on Xcode 6 when I deleted the already included ViewController.h & ViewController.m files from my new view based project, and deleted the scene that was related to this class from storyboard, Xcode cashes these files in derived data folder, so if you try to go to Window -> Projects -> your_project and delete the derived data everything will go fine.


This can happen in any Xcode above 6.0. It happened to me after renaming some ViewController classes in Swift project (but I guess it will happen with Obj-C too). You just have to open the interface builder, go to Identity Inspector of ViewController that had its class renamed, select class and press Enter. That will reassign renamed class to selected ViewController and also reset Module Value which gets lost after renaming the class.

Update for Xcode 8.1 (probably 8.0 too):

Xcode 8.1 just crashes. Simply and annoyingly just crashes and doesn't print anything. I was chasing that phantom crash for an hour just to find out that it was this very same thing - unassigned class in IB. If you're getting some phantom crashes, double check IB for unassigned classes first.


You need to check the box "Inherit Module From Target" Checkbox

enter image description here


I was playing with Spring class. And this error happend to me because i used folder as reference when moving whole folder class to project instead of creating groups. So this was my solution, dont use folder as reference but create groups.


I had the same problem with Xcode Version 6.1 (6A1052d). I think the problem appears if you renamed your App / Xcode Project.

My solution was to add the module name in the interface builder manually.


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.


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.


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.


This worked for me..

Check your compiled source, whether that file(e.g; ViewController.m) is added or not, in my case ViewController file was not added so it was giving me the error..

enter image description here


In my case the problem was due to having our main storyboard set as the Launch Screen, and I'd get a console error (no crash) at app start for every custom view controller referenced in the storyboard.

We'd covered from XIBs and launch images to storyboards and I hadn't yet gotten around to getting the launch screen working again. When I finally got around to creating a bare bones launch storyboard with no custom view controllers (which aren't allowed) these console errors stopped appearing.


Swift 3 solution.

All these did NOT work.

  1. Clicking on Module on right pane did NOT work.
  2. Adding @obj did NOT work.
  3. Restarting did NOT work.
  4. Moving to desktop as xcode breaks for longer path is NOT working. ...

This worked finally.

Just create new directory and create a new project inside that. Add the files except Main.sotryboard.

Now copy the view controllers from previous project and paste it into new Main.storyboard.

Voila ! This works.


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.


Sometimes the controller you are providing loses its target membership from the current application. In that case, pressing enter on the "Module" field will do nothing. Go to the controller and make sure that it has target membership set to the current app.


My issue was related to a podfile framework (specifically the 'BWWalkthrough'). None of the above solutions worked for me, and no matter how I tried I couldnt get the module to point to my app.

What ended up working for me was removing the library as a podfile and add it directly to my project as a static library. Everything was hunky-dory for me after that. Not entirely sure what was 'broken' with the pod implementation of the class.


in my case , i setup app as universal app, so xcode creates two storyboards.but i was only using(designed) only iPhone storyboard. and trying to run app in iPad.for resolve problem just need to make app as only for iPhone and works great.


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


I fixed this along the lines of what Laura suggested but I didn't need to recreate the files.

Using XCode 4, in the Project Navigator, select the .m file that contains the class that it is complaining about

Go to View->Utilities->Show File Inspector (this will show the File Inspector to the right, with that .m-file info)

Open the Target Membership section and make sure that your target is selected for this .m-file

When I added my .m file to my project, it didn't add it to my default target for some reason and that caused me to get the error you mentioned.


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


For me, I'm using Xcode7 + Swift2

Solved this problem by checking my code, I have this line in my viewController:

 self?.navigationController?.pushViewController(vc, animated: true)

Then I realized that I haven't get navigationController connected to the detail page. So if you're pushing a new ViewController with customized ID, better to check that.


I'm a PyObjC user and I had my NSView subclass in its own file. What solved this problem for me was to move the NSView subclass from its own file into my AppController.py file. This is the file that has the application controller in it.


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


Selecting the proper Module for my Custom Class I solved this problem .

Here it is :

enter image description here


These steps work for me.

1) Clear Derived Data.
2) Remove .h and .m files
3) Create .h and .m files Again


For me the problem was that I was referencing a custom class in the storyboard (which matched to a .h file) but I didn't have an @implementation command in the .m file.


Don't use spaces in the project name, otherwise the Custom Class will not find your own classes.


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.


Sometimes Xcode missed customModule="AppName" customModuleProvider="target"

To fix it, open storyboard as source code and replace this line:

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

to this:

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

I had the same problem, but not the same fix.

The project folder was kinda corrupted so i had to copy my project folder to another folder, for example your desktop and after that open the project.

When it opened go to your interface builder project and you will see he recognise your script, Then you click indeed on the name of your script and press enter, u will see the module input will fill it self.

And it will work like a charm! :D


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

@objc(ForumTopicListViewController) class ForumTopicListViewController

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.


What only worked for me is actually adding the module name to the xib file...

Sooo, the xib files look like this:

mymodule.MyViewController.xib (Module being the name of the proyect, usually)

HORRIBLE solution in my opinion, but that is supposedly how Apple wants us to do it now.

This question shows 3 possible work arounds back in beta 4 ... apparently Apple has not been very helpful in this situation according to some because they call it "Working as intended."


This worked for me when nothing else did. From the project directory in terminal:

[~/Developer/MyProject] grep -rn ViewController * | grep -i xib 

Open the matched files as source code in Xcode and change any instances of ViewController to what you actually need. In my case the file I needed to open as source was Main.storyboard and I changed instances of ViewController to DetailViewController.

I deleted two files from Xcode and main.storyboard which is what I believe caused this issue for me to begin with.


My answer: set custom Module equal to the custom Pod name (in my example - custom class name) like on the screenshot attached

This solution is for a specific case: for custom views classes from Pod (or Carthage) framework.

Infrastructure: XCode8, Swift3

enter image description here


This really wierd when XCode 10 stopped to "refine debugs".
In my case, i setted UITableViewDelegate and UITableViewDataSource with Storyboard and forget to implemente those required methods.
I just wanted to test the view first, before implement those methods, then crash! XCode 9, will warning about those methods, but XCode 10, really maked my code slow, not on this one, others i been thru this "error doubt".
Hope this help someone.
Thanks


Enabling Inherit Module From Target took the correct target module. That solved the issue.

enter image description here


I had the same problem with Xcode 6.3 when I add files to "myapp". That's because I choose "create folder reference" instead of "create groups".I delete these files and add them again with the "create groups" option.And the problem fixed.


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


For me i've tried all the solutions in this question didn't work , i finally made it by .

copy the pod .h .m files into my project and imported the .h into my project c header.

then i went back to storyboard the class was UICountingLabel i removed it and hit enter ( empty no class ) , then i added it again and hit enter, worked successfully .


My solution was to remove @objc from Custom class definition.


The solution was different for me. You need to add the .m of the class to the build phase compiled sources of the target.

Hope this helps!


In my case, the class referenced in the Storyboard / xib did not have Target Membership set.

To fix, give that class's .h and .m files the same Target Membership as your other classes.

No target membership set.


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


I faced the problem when I ported the storyboard from Swift project to Objective-c project, noticing vvkuznetsov's answer, it turned out the two project using same identifier. I "Product -> Clean" and tap Enter key on the Module and Class text field. the issue went away.


In mij case the ViewController.h/m where in a lib. The projects still builds but since Xcode 6.3 the above error was shown at run-time. Moving both files back into the project solved the issue.


It happened to me because my class was marked with @objc and in sotryboard it couldn't find the module. Removing @objc fixed the problem


Check if your class has right Target Membership.


What @gfrs said is correct, you need to set the Module. However I once ran into an issue that my class wasn't listed in the Class dropdown. Eventually I removed the swift file, re-started Xcode and re-created the file. Finally the class was listed and could be used in Storyboard.

Also have a look at this answer, which looks like to solve the 'real' problem I encountered.


My issue was user error. I had a generic UIView in my storyboard and in the Custom Class section of the Identity Inspector I had accidentally changed the name from UIView to gibberish.

All it took to fix was to change it back to UIView.


I faced a problem when I created a project with the same name that already existed in my projects directory (though it was deleted some time ago). I wrote my solution there https://stackoverflow.com/a/27763697/1654692


Examples related to ios

Adding a UISegmentedControl to UITableView Crop image to specified size and picture location Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Autoresize View When SubViews are Added Warp \ bend effect on a UIView? Speech input for visually impaired users without the need to tap the screen make UITableViewCell selectable only while editing Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Examples related to xcode

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 iPhone is not available. Please reconnect the device Make a VStack fill the width of the screen in SwiftUI error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65 The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Xcode 10: A valid provisioning profile for this executable was not found Xcode 10, Command CodeSign failed with a nonzero exit code

Examples related to xcode6

'Framework not found' in Xcode No suitable records were found verify your bundle identifier is correct unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard Move a view up only when the keyboard covers an input field My prerelease app has been "processing" for over a week in iTunes Connect, what gives? Programmatically navigate to another view controller/scene Changing the Status Bar Color for specific ViewControllers using Swift in iOS8 Change tab bar item selected color in a storyboard How do I change UIView Size? How to get textLabel of selected row in swift?

Examples related to interface-builder

Could not insert new outlet connection: Could not find any information for the class named Xcode 6 Bug: Unknown class in Interface Builder file Xcode 6 Storyboard the wrong size? UIScrollView Scrollable Content Size Ambiguity How to change navigation bar color in iOS 7 or 6? How to use auto-layout to move other views when a view is hidden? Is it possible to set UIView border properties from interface builder? Should IBOutlets be strong or weak under ARC? How to make UIButton's text alignment center? Using IB Change button text from Xcode?

Examples related to uistoryboard

Xcode 6 Bug: Unknown class in Interface Builder file Prepare for Segue in Swift Best practices for Storyboard login screen, handling clearing of data upon logout iOS: present view controller programmatically How to call a View Controller programmatically? How to use UIScrollView in Storyboard What are Unwind segues for and how do you use them? How to set the UITableView Section title programmatically (iPhone/iPad)? Programmatically set the initial view controller using Storyboards How to Implement Custom Table View Section Headers and Footers with Storyboard