7

In an app, suddenly it's giving me the error XCode Unknown class ***** in Interface Builder file. I reviewed everything, storyboard, classes, etc.

I try to rename the class but it is the same problem, even I created a new class and copy the code in. I think XCode is taken that from a kind of cache because even properties that I deleted like the icon in the tab bar item are still present in the app when I run it.

What can be the problem?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Laure_f_o
  • 628
  • 1
  • 7
  • 15

4 Answers4

6

Also if using a static library, don't forget to add the -ObjC flag to Other Linker Flags in your projects Build Settings tab.

If you have failed to do so, "Unknown class ... in Interface Builder file" will occur when trying to load a view controller from the static library in IB.

Just another case I experienced the error will show.

Joe Collins
  • 458
  • 3
  • 12
3

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). Xcode didn't understood that it's a new project and use build directory of old project as a build directory for a new one. I didn't knew how to completely rebuild project from scratch and I just removed a build directory. In my case I removed /Users/username/Library/Developer/Xcode/DerivedData/ProjectName-suffix. You can find it in Xcode in Project navigator on the left by selecting ProjectName->Products->ProjectName.app and File inspector on the right will show you a full path to file.

vvkuznetsov
  • 1,056
  • 1
  • 9
  • 16
1

Sorry, after trying several post I found one solution, delete the folder of the simulator in /...Library/Application\ Support/iPhone\ Simulator/ and removing the class and re-adding it.

Laure_f_o
  • 628
  • 1
  • 7
  • 15
0

You will need to add to your targets Other Linker Flags as well, just adding to the Project Build Settings does not seem to work.

David Knight
  • 763
  • 6
  • 12