Ajay
Ajay

Reputation: 1622

XCode 6.3 bug: Unknown class in Interface Builder file

I am working with XCode 6.3 & Swift.

I have just added a few view controllers in my storyboard & added the custom classes & set the respective custom classes in identity inspector.

enter image description here

But while I run the app it shows Unknown class X in Interface Builder file. & I am not able to interact with my custom classes. There are few similar questions like this & I have tried all the solutions but none of them are working for me.

Upvotes: 1

Views: 3300

Answers (4)

Oyvkva
Oyvkva

Reputation: 511

All my viewControllers were ok, but I searched through he whole storyboard file and found this:

<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC" customClass="end">

Removing the custom class got rid of the error:

<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">

No idea why this custom class was there in the first place.

Upvotes: 2

JoshuaK
JoshuaK

Reputation: 41

It may seem like a tedious thing but make sure that everywhere you have referenced the view controller it has been spelled correctly. I regrettably spent a lot of time attempting all of the suggestions to fix the error and it turned out to be a simple spelling mistake!

Before:

UIViewController *myViewController = [[FormApplicationViewController alloc] initWithNibName:@"FormApplicationviewController" bundle:nil];

After:

UIViewController *myViewController = [[FormApplicationViewController alloc] initWithNibName:@"FormApplicationViewController" bundle:nil];

Upvotes: 0

idreamincode
idreamincode

Reputation: 47

I restarted my Macbook and all modules started to populate in the Custom Class box. No created classes were showing in the dropdown box.

I'm on Xcode 7.0.1, OSX 10.10.5 on a 2015 Macbook Pro. That was a really annoying error to figure out.

Upvotes: 0

iAnurag
iAnurag

Reputation: 9346

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

Upvotes: 6

Related Questions