18
votes

When I run my application i got this I see in my console this message "Unknown class FirstViewController in Interface Builder file."

I am running TabBar application.

How can I fix this?

9
Are you using a template provided by Xcode? If yes, that FirstViewController might come from that template. - Di Wu
If you created a Tab Bar application from the template provided by Xcode you will find FirstViewController in generated code. Just delete the FirstViewController if u are not going to use it. - Swapna
@Swapna: yeap... I deleted that FirstViewController..... those it effect my project. if i delete FirstViewController. - kiran kumar

9 Answers

21
votes

It looks like you deleted FirstViewController.h & .m from project, but forgot to change view controller's class in nib file.

20
votes

Go to project , targets , build phases , compile Sources and add the unknown class ..done.

7
votes

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

3
votes

It is kinda hard to understand your comments, but I think you may have deleted the FirstViewController but forgot to change all the references to it. you may need to go to MainWindow.xib and look for all FirstViewController UI components and delete them

1
votes

Sometimes it happens when you change target name for some reason, you have then to open storyboard as source file, then search for old target name, replace it with the new name, should work if it is the case, hope it helps.

0
votes

This can also happen if you use the same package name for multiple projects (if you're being lazy with your provisioning). Go into your user directory, then go to Library/Application Support/iPhone Simulator/[your sdk version]/Applications and delete what's in there. You may also have to delete the app from the device. That will remove any accidental references to files from other projects, which can cause this error.

0
votes

When you add multi project to Workspace. If you use the same Product Name in your's projects. It can conflict.

Rename Product Name in the projects have a same name.

... Hope this help ....

0
votes

This happened to me just after Git merge and resolving few conflicts.
It had screwed up my XCode project.

I tried all over the StackOverflow. At first I thought my Custom class .m file hasn't been added to the Compile Sources class list. But it's one case, however even after adding it, it gave me same issue back.

How I resolved:

  1. I kept a backup of my .xib file and its backing custom class .m and .h files.
  2. Then clean the project and try to run the app via XCode (which might not work)
  3. Then re-add the files back to the XCode project and it will work.

Cheers!

0
votes

This can sometimes happen if you made changes to a VC i.e. deleted prototype cell(s) within a tableview.

If all else fails I find cleaning project and restarting Xcode gets things back on track.