18

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?

Community
  • 1
  • 1
kiran kumar
  • 1,349
  • 4
  • 21
  • 40
  • Are you using a template provided by Xcode? If yes, that FirstViewController might come from that template. – Di Wu Jan 04 '11 at 08:56
  • 1
    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 Jan 04 '11 at 09:10
  • @Swapna: yeap... I deleted that FirstViewController..... those it effect my project. if i delete FirstViewController. – kiran kumar Jan 04 '11 at 11:06

9 Answers9

21

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

Nickolay Olshevsky
  • 13,706
  • 1
  • 34
  • 48
20

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

Matthew
  • 201
  • 2
  • 2
  • This worked for me - followup question: Why did this happen in the first place? I have plenty of other classes that are not listed in compile sources, and they are picked up just fine. – The Camster Dec 12 '13 at 19:50
  • Same question here. I just open a storyboard, add a viewcontroller, and immediately get this error. Is this a bug in XCode? – Kokodoko Jul 25 '14 at 11:36
7

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

user1685442
  • 161
  • 2
  • 5
3

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

vodkhang
  • 18,639
  • 11
  • 76
  • 110
  • @vodkhang......Thanks friend......Its Working Fine and perfect....Thanks a Lot... But... I need to know If i did not delete that those it effect my project......? or its memory problem. – kiran kumar Jan 09 '11 at 10:21
  • if you don't delete them, everything will be ok,no problem – vodkhang Jan 09 '11 at 10:23
  • 1
    Same problem here, there are no references to be found anywhere, but the error still persists. – Kokodoko Jul 25 '14 at 11:37
1

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.

IsPha
  • 389
  • 4
  • 9
0

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!

Randika Vishman
  • 7,983
  • 3
  • 57
  • 80
0

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.

GordonW
  • 1,120
  • 2
  • 16
  • 36
0

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.

Rich Lowenberg
  • 1,089
  • 1
  • 8
  • 12
0

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

duongvanthai
  • 1,518
  • 1
  • 11
  • 14