Unknown Class **** in Interface Builder file
I added a UIView xib file using the root class of
I created it in the wrong place and so moved it in the project. Same project just a different folder/group.
I then had a problem when running saying…
Unknown Class MyView in Interface Builder file
I couldn’t work out what was wrong so I have now deleted the files both from the project and from the directory.
I’ve done a search using SublimeText2 for the string “MyView” and it doesn’t exist anywhere in the project.
I’ve reset the simulator, cleaned the project and the build folder and deleted derived data.
Still getting the same error.
Any ideas what I can do now?
8 Solutions Collect From Internet About “Unknown Class **** in Interface Builder file”
Sometimes IBuilder missed
To fix it, open storyboard as source code and replace this line:
<viewController storyboardIdentifier="StoryboardId" id="SomeID" customClass="CustomClass" sceneMemberID="viewController">
<viewController storyboardIdentifier="StoryboardId" id="SomeID" customClass="CustomClass" customModule="AppName" customModuleProvider="target" sceneMemberID="viewController">
Go to View -> Utilities
Goto File Inspector of .m file
Open the Target Membership section and make sure that your target is selected for this .m-file
appcode is very stubborn in keeping the old xib cached somewhere, and if you have the cached xib and it has the same name that your controller it will try to load it on start.
what I do after deleting a .xib:
- delete app from the device
- clean build folder in app code
- invalidate caches and restart, kill appcode before it starts
- delete derived data in xcode
- start appcode
step 4 shouldn’t be necessary, but my feeling is that without it I am still seeing the deleted .xib
If you have multiple targets in your Xcode project, make sure that the class the was mentioned in the error file is compiled for the target you’re testing with as well.
OK, so I deleted all references to the class causing the problem but still nothing.
However, I also had a UIViewController subclass called
MyViewController. This wasn’t being loaded in any IB file so I don’t know how it was causing the problem.
I changed the name to
Build – Run – works.
I don’t know how or why but it works now.
I had the same issue when I had multiple class declarations in one file.
What I did is I declared a UITableViewCell subclass in one of my view controllers, and forgot to put the UITableViewCell subclass’ @implementation in the view controller’s .m file.
As my experience, All solutions above had not worked out.
Then I had to re-input the custom class in all strayed Xibs.
As an amazing result, it just succeeded and what I had done reconnected the lost connection between @interface and IB.
Hope to be useful.
This happened to me when I renamed the custom view class, and the module (in the identity inspector when the view is selected) was blank. It remained blank because Xcode didn’t autocomplete the custom class name, hence it left the module blank. All I had to do was re-enter the class name after a build, and then it autocompleted, and selected to appropriate module (Current – Target)
- Fast blur on iOS
- iOS: Convert UTC NSDate to local Timezone
- Is there a practical way to compress NSData?
- How to achieve paint brush strokes in iOS
- How to open Google Maps to show route using Swift
- How to remove tmp directory files of an ios app?
- Why is my image not being appended to the array?
- Ensuring Async Action Has Completed in Firebase
- XCode: How can I verify an IPA is valid before uploading?
- How to create a simple checkbox in iOS?
- UISearchController searchBar in tableHeaderView animating out of the screen
- NSNumber vs Int
- Xcode 4 code sense is not working
- How can I detect yawn using Open CV
- Get signed integer from swift string of binary