"Unknown class <MyClass> in Interface Builder file" error at runtime
Asked Answered
U

46

261

Even though Interface Builder is aware of a MyClass, I get an error when starting the application.

This happens when MyClass is part of a library, and does not happen if I compile the class directly in the application target.

Unbosom answered 12/11, 2009 at 22:34 Comment(4)
How do you link to the library?Cesaro
I use a dependent subproject, and did a drag'n'drop from the Xcode subproject's products into my current target's "Link Binary With Library" build phase.Unbosom
If the class is from CocoaPods, this might help github.com/CocoaPods/CocoaPods/issues/491.Pyridoxine
Could be related? https://mcmap.net/q/63930/-xcode-6-bug-unknown-class-in-interface-builder-fileRaul
U
224

Despite the "Unknown class MyClass in Interface Builder file." error printed at runtime, this issue has nothing to do with Interface Builder, but rather with the linker, which is not linking a class because no code uses it directly.

When the .nib data (compiled from the .xib) is loaded at runtime, MyClass is referenced using a string, but the linker doesn't analyze code functionality, just code existence, so it doesn't know that. Since no other source files references that class, the linker optimizes it out of existence when making the executable. So when Apple's code tries to load such a class, it can't find the code associated with it, and prints the warning.

By default, Objective-C targets will have -all_load -ObjC flags set by default, which will keep all of the symbols. But I had started with a C++ target, and didn't have that. Nevertheless, I found a way around this, which keeps the linker aggressive.

The hack I was originally using was to add an empty static routine like:

+(void)_keepAtLinkTime;

which does nothing, but that I would call once, such as:

int main( int argc, char** argv )
{
   [MyClass _keepAtLinkTime];
   // Your code.
}

This would force the linker to keep the whole class, and the error disappears.

As jlstrecker pointed out in the comments, we do not really need to add a _keepAtLinkTime method. Simply calling an existing one, such as:

   [MyClass class];

does the trick (as long as you derive from an NSObject).

Of course, you can call this in any location of your code. I guess it could even be in unreachable code. The idea is to fool the linker into thinking that MyClass is used somewhere so that it isn't so aggressive in optimizing it out.

Xcode 6.3.2 & Swift 1.2

Swift definition of view. Be sure to override init(coder aDecoder: NSCoder). Objective-C definition of view controller. And, a nib in a pear tree.

Add Module Name to Nib details inspector where you pick your class.

Unbosom answered 12/11, 2009 at 22:34 Comment(15)
The .xib data isn't loaded at runtime. The IB compiler compiles the xib to a nib; the nib is what gets loaded at runtime.Caftan
You don't have to modify MyClass. Just call a method it inherits from NSObject, like +class.Iconic
Though it was no Xcode 4 when original question was posted, the following still seems to be appropriate. In Xcode 4 instead of adding some dummy method to eliminate the error, you can check all the needed targets of MyClass.m in the Target Membership section of the File Inspector.Confirmand
Another possibility these days is that MyClass.m might not be in your Compile Sources build phase. This can happen if you drag MyClass.h/m into your project, rather than creating them using New File.Trefoil
Thats exactly what fixed it for me Steven. Adding the classes to the Compile Sources build phase sorted it.Lucho
For me, [MyClass class]; works, But dragging .m file to compiled sources and checking targets in Target memberships did not work. I am using XCode 4.5 though.Feingold
@ParamasivanSamuttiram, mine too, it is already in compiled sources and targets, but it still crashing, calling [MyClass class] just before [NSBundle loadNibNamed:@"xibname"]; works wonderSceptic
Xcode5 still has this bug: new targets are SOMETIMES created without the "-ObjC" option in "other linker flags". Grr. But "-all_load" is no longer needed - they (finally) fixed that bug.Pizza
Updated for Xcode 6.3.2 and Swift 1.2 after running into the same problem. CheersVervet
@JoshBruce can you explain the Swift solution? I don't really understand it.Maureenmaureene
I got this issue on an ObjectiveC++ file, with .mm extension. Thank you for the fix!Marston
Same error when using a class from static library - fixed, thank you!Hassi
Helped me while referencing custom class from xib located in a Bundle targetCrescentic
@Unbosom Thank you very much! I had the exact same problem (Xcode 8.2.1) and your solution (directly reference the dependent class) fixed it. I went so far as to use objdump to confirm that with(without) the fix, the application binary did(did not) have a reference to the dependent class.Latona
FINALLY someone explains why this is going on instead of pointing to IB.Adrian
L
184

I fixed this along the lines of what Laura suggested but I didn't need to recreate the files.

  • Using XCode 4, in the Project Navigator, select the .m file that contains the class that it is complaining about

  • Go to View->Utilities->Show File Inspector
    (this will show the File Inspector to the right, with that .m-file info)

  • Open the Target Membership section and make sure that your target is selected for this .m-file

When I added my .m file to my project, it didn't add it to my default target for some reason and that caused me to get the error you mentioned.

Lebanon answered 12/11, 2009 at 22:34 Comment(8)
It is true that sometimes, the linker error is due to simply not compiling your file in your target in the first place. What you describe is the way to control the target(s) that a file is associated to. Unfortunately, my file was already part of my target, but I still had a link issue. This was probably due to my library being C++ (as opposed to Objective-C), which has different default linker flags (see posts by Alasdair Allan and Sijo above).Unbosom
This suggestion worked for me, although slightly differently, since my "Target Membership" checkbox was already checked. I unchecked it and re-built, but then the error message changed to indicate my new class name. Re-checking the box and building again, everything now works. Much easier than deleting cache files!Hurds
Great solution via Xcode UI. @electromaggot, Xcode may get confused when you add classes manually, so you may need to add more than one file.Homozygous
This is solution for me as well. I had dragged in some class files from another project, and those class files were the ones which raised the exception.Swathe
I deleted a file from my project then added the same file back later and this solved the problem.Fleer
Exactly what I needed. This is the correct answer for me. I had dragged this file into the project and I remember seeing a question "Add this to Target...." and only the "Tests" was selected. It didn't dawn on me what I had done until I started having this error. At that point I could not figure out how to correct my original blunder. The idea of outsmarting the linker might work but what a nightmare.Mccreary
You have saved my life. I had to revert my project file and re-added the source files and nothing was working anymore. Stupid xCode not doing it's job!!! Thanks.Vania
I think this is better than the currently marked answer using the latest Xcode versions. This worked for me using Xcode 6.1.Bang
K
73

This doesn't really have anything to do with Interface Builder, what's happening here is the symbols aren't being loaded from your static library by Xcode. To resolve this problem you need to add the -all_load -ObjC flags to the Other Linker Flags key the Project (and possibly the Target) Build Settings.

Since Objective-C only generates one symbol per class we must force the linker to load the members of the class too by using the -ObjC flag, and we must also force inclusion of all our objects from our static library by adding the -all_load linker flag. If you skip these flags sooner or later you will run into the error of unrecognized selector or get other exceptions such as the one you've observed here.

Ketchan answered 12/11, 2009 at 22:34 Comment(5)
I found that just the -ObjC flag alone fixed it in my case.Salinger
@Salinger that is because your version of Xcode (LLVM) is more recent than the guy writing this answer had used. Nowadays, using -ObjC is good enough for fixing the issue.Airedale
this only helped me. During compilation it showed necessary framework related issues which also resolved once i imported all the frameworks.Hillaryhillbilly
-ObjC flag alone fixed my issue. I actually got error for having all_load attribute in iOS7.Epileptic
Using -all_load -ObjC might cause unnecessary increase in product size. this issues happens with category files too in frameworks only.Anglaangle
C
26

I did run into this problem today using Swift.

I changed a class Model.h + Model.m to a Model.swift. This object was used in Interface Builder with the class = Model.

As soon as I replaced the object the class could no longer be loaded.

What I had to do was to change the class reference in IB from:

Class = Model
Module = 

to

Class = Model
Module = <TARGETNAME>

You'll find the <TARGETNAME> in the build settings. It is also the name that shows up in your generated Swift-Header: #import "TARGETNAME-Swift.h"

Cadmus answered 12/11, 2009 at 22:34 Comment(5)
This seems to be the correct answer. Unless someone can say otherwise, this should be marked as correct.Cassette
Great answer thanks. For me the Module name was right there in the drop down. It was the name of my app.Livy
It works for me. For my problem, the <TARGETNAME> mentioned in your answer, is the framework's name which contains the class.Treiber
I came to the conclusion on my own this was also the error I was getting and was willing to post my findings when I saw your post. I actually saw it but passed it by, because of the many answers and the noise around it. I think your answer could be improved by some screenshots to differentiate your answer from the others. I'd sure catch it if it were so. Many thanks, anyway, for posting it here. You got my upvote.Arv
For the AppDelegate, I was able to fix this in the Interface Builder UI. For the custom class of a UI element within a window, the Interface Builder UI would not let me set the custom class and module. I had to do the following: (1) Open the .xib file as "Source Code" (right click on it). (2) Add the attribute "customModule=<TARGETNAME>" next to the customClass attribute.Ave
B
20

Go to the "ProjectName" , click on it , and then go the "Build phases" tab , and then click on the "compile sources" , and then click on "+" button , a window will appear , the choose "MyClass.m" file and then click "add" ,

Build the Project and Run it , the problem will surely get solved out

Begrime answered 12/11, 2009 at 22:34 Comment(2)
yes, i hadn't checked ALL of the target boxes i wanted to add to my newly imported classes to. Thanks!Afterclap
Yes! My VC file was missing from the Target project.Kinata
A
19

It's a Xcode4 cache problem, just delete all folders under /Users/your_user/Library/Application Support/iPhone Simulator/4.3/Applications/

Also if you have the same issue testing on your iPhone, delete the old app before running it...

Good luck. Pascual

Angell answered 12/11, 2009 at 22:34 Comment(4)
In the Project Build Settings you need to add the "-all_load -ObjC" flags to the "Other Linker Flags" key. This is not an Xcode 4 specific problem, and in fact generally has nothing to do with Interface Builder either.Ketchan
This solution was already suggested in January 2010 (see above).Unbosom
Yes - the easier way to do this is just open the iOS Simulator and from the menu choose 'Reset Content and Settings'Instrumental
Or you could do what I did and just delete the app in question from the Simulator home screen. I had the same error message, but it was referencing an old app delegate.Succursal
C
16

Sometimes IBuilder 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">
Crannog answered 12/11, 2009 at 22:34 Comment(4)
Using Xcode 6.3 (6D570) as soon as I run the setting reverts back to the original (bad) one. Bug? I am trying to include a swift file in an Objective C project.Atahualpa
On XCode 6.4, just adding customModuleProvider="target" in the storyboard source code, under the desired viewcontroller, fixed the problem.Capillary
I was able to resolve my issue with just customModule="MyFrameworkName". Huge +10Columbous
Actually, my issue was the opposite, I wanted to delete the CustomTaget but Xcode was not changing the xib source file, So I had to delete customModule="AppName" customModuleProvider="target" to make it work.Imaginative
D
15

My case - Trying to use a Class from a swift framework in my objective c project, I got this error. Solution was to add Module (swift framework) of the class in Interface builder/ Storyboard as shown below. Nothing else

enter image description here

Defrock answered 12/11, 2009 at 22:34 Comment(3)
I'm using a Swift framework in Swift project installed by CocoaPods. This method works. And the module name is the framework's name.Conflagration
This is perfectly works. Need to why that module is removed ??Perplexity
Works perfect with cocoapod frameworks issues...kudos to you for perfect answer...Pecuniary
O
13

In my case it was showing an error for a class that didn't even exist! I suspected it was something that got borked in the storyboard file. If you don't recognize the class file in the error try this:

1) open your project in sublime or another good editor. Search for the class being referred to. 2) remove the whole bit that says

customClass="UnrecognizedClassName"

3) save it. 4) return to xcode and clean the project, and try running it now.

worked for me.

enter image description here

Outflow answered 12/11, 2009 at 22:34 Comment(3)
I use the OSX TextEdit app. It worked fine for this operation. Be sure to close your project first and close Xcode.Isthmian
That helped too. I had more than one object with the same customClass, I probably clicked the view instead of the controller and assigned the same name.Radiosurgery
This was also the solution to the problem I encountered; I had previously entered a partial class name and somehow the storyboard got saved that way (e.g. customClass="MyCla"). Instead of deleting the custom class assignment, it was prudent for me to simply put in the class I intended to use in the first place :)Abcoulomb
D
13

Go to Build Phases-> Compile Sources and add your new .m files.

Dorcasdorcea answered 12/11, 2009 at 22:34 Comment(1)
Yep, after adding new files from a previous project into a XCode 4.5 project, adding the .m files to the Compile Sources list got it done for sure. Adding "-all_load -ObjC" didn't work in my case, didn't hurt though.Supat
S
9

The best way to remove the error is: 1) Select the Class File (.m) 2) Under "Target Membership", "check" the Project name entry

Singleton answered 12/11, 2009 at 22:34 Comment(2)
This works. I was developing a pod and for some reason the pod install command was applying the wrong target to one particular class file. It was being applied to a resource bundle that I had. The correct config is Pods-<project-title>-<pod-title>Deplorable
This doesn't work for me. The target membership is correct, but the error keeps occurring.Preconceive
S
9

I just want to add this answer since most if not all the answers here assume that the class actually exists.. it's just that the linker/compiler is too dumb to see it.. thus the answers revolve around either alerting the linker to the existence of the class or creating a hack to 'force' exist it..

my problem happens when this message is actually talking about a non-existent class.. so an example would be me reverting back to an old git revision that has no knowledge of a certain class.. yet the compiler complains that the said class doesn't exist..

solution?

  • Nuke the whole thing! first delete all the build files etc by deleting all the contents in this directory ~/Library/Developer/Xcode/DerivedData
  • delete the app from the phone itself (and clear the simulator contents if you are using a simulator)

you should be good to go after that

Surfbird answered 12/11, 2009 at 22:34 Comment(2)
Can't +1 this one enough, fixed my problem. My issue was exactly the same where the file had already been deleted yet the warning was still appearing when compiled.Nelson
In the Storyboard you have to fill in the Identifier. Sometimes I write it in the "Class" field (in the Identity Inspector) by mistake. So the compiler is complaining with a reason that the Class does not exists!Malleus
C
8

I fixed this by copying the text from my class.h and .m, deleting those class files from the project, and creating new class.h and .m files with the same name using "Add File". Then I pasted the code back into the new files, and everything worked great. Somehow the files weren't linked correctly when they were created. I didn't need to use any linker flags after that.

Coppery answered 12/11, 2009 at 22:34 Comment(3)
when I had first created the files I didn't have a .m at the end. I tried renaming the file and adding it back in, however I still had to delete and recreate the file before xcode was happy.Nahshunn
Your file probably wasn't part of your target. Re-adding it likely ended up with a default checkbox in the proper target.Unbosom
This solution also worked for me, but I made 100% sure that before I deleted the first class (.h + .m), I checked that it was part of my target. That was not the problem for me. Like Laura, I just deleted the class and made it again (with a different name), and it worked fine, without any of the other solutions on this page.Falgout
T
7

I FINALLY fixed this, I had forgotten to add the following code to my .m file:

@implementation MyTableViewCell

@end

So it was being caused because I had made a placeholder @interface for my table cell, that had a connection to an element in the .xib file, but there is a bug in Interface Builder where if no @implementation is specified for a class, it can't find it.

I had gone through all of the steps from other forums of viewing the .xib as source and seeing MyTableViewCell even though I had commented it out of my code. I had tried resetting the simulator. I even tried breaking all of my classes up into separate files named the same as the interfaces, but nothing worked until this.

P.S. in my experience, it doesn't matter if the names of the .h/.m files are different from the names of the @interface. I have several files containing more than one @interface and they work fine.

P.P.S. I have a more detailed explanation of why UITableViewCell and UICollectionViewCell cause this error at https://mcmap.net/q/66232/-uicollectionview-doesn-39-t-contain-uicollectionviewcell-in-ib along with how to reveal it at compile-time using registerClass: forCellWithReuseIdentifier:.

Tooth answered 12/11, 2009 at 22:34 Comment(0)
C
6

In my case, I have XCode6, the specified class .m file end up in the wrong place in build phase - It should have been under Compile Sources, but end up in the Copy Bundle Resources

Calamus answered 12/11, 2009 at 22:34 Comment(1)
Thanks to you I started looking at the list and found out that my file was just missing, probably when I created it I didn't set the targets rightChickasaw
D
6

just add below code at the starting of appdelegate applicatoindidfinishlanching method,then it will works fine

[myclass class];

Disassembly answered 12/11, 2009 at 22:34 Comment(0)
T
6

This happens because the .xib has got a stale link to the old App Delegate which does not exist anymore. I fixed it like thus:

  • Right click on the .xib and select Open as > Source code
  • In this file, search the old App delegate and replace it with the new one
Taphole answered 12/11, 2009 at 22:34 Comment(1)
Open as Source Code no longer exists, but you can just as easily right click, Show in Finder, then right click on the file, and open in TextEdit. Of course, backup the file before you make any changes ;)Jalisajalisco
K
5

I tried this, and other, answers listed on this site, none of which sorted it for me. This comments (from http://www.iphonedevsdk.com/forum/iphone-sdk-development/43330-unknown-class-interface-builder-file.html) helped:

After searching and searching and searching, I finally discovered the name of this deleted class hidden in a file. I had to open the interface builder files in X-code, by right clicking on them and choosing 'view as source code'. Then searching for it came up with

<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchP lu gin</string>
<string>*this was the class name*</string>

Simply removing that last line doesn't fix it unfortunately, complaining that there are the wrong number of items in the file. You need to remove the corresponding line in the section of lines above it, which refers to CustomClass.

Kangaroo answered 12/11, 2009 at 22:34 Comment(0)
G
4

This problem does not seem to get outdated.

I had the same issue with Xcode 8 and solved it similiar like smilebot:

  1. Open your storyboard file as "Source code" within Xcode:

  2. Search for the class being referred to & remove the whole bit that says

customClass="UnrecognizedClassName"

  1. Open your storyboard file as "interfacebuilder - storyboard" again and rebuild your app.
Giraud answered 12/11, 2009 at 22:34 Comment(0)
D
4

Not only in project settings, but in Target setting also u have to add -all_load -ObjC flags..

Core-Plot: Unknown class CPLayerHostingView in Interface Builder file

Danitadaniyal answered 12/11, 2009 at 22:34 Comment(0)
C
3

I had 'Unknown class favouritesButton in Interface Builder file' and tracked it down to a storybook scene where the button in question had a bogus custom class of "favouritesButton" in the Class field at the top of the Identity Inspector. I meant to put that value in the next field: Identity Label.

Changing this to "UIButton" solved the problem.

Cyclone answered 12/11, 2009 at 22:34 Comment(0)
J
3

Just remove the MyClass.m and .h and add them to project again is work for me.

Judicative answered 12/11, 2009 at 22:34 Comment(0)
I
2

I ran into this in Swift.

Moving the .xib file into the project's Base.lproj folder got rid of this error.

Inspire answered 12/11, 2009 at 22:34 Comment(2)
Thanks for sharing this, but it didn't solve my issue. Here is the solution I finally found: https://mcmap.net/q/66234/-unknown-class-info-in-interface-builder-fileCatholic
I did run into that problem too. But in my case the missing module name was the problem: See <https://mcmap.net/q/65135/-quot-unknown-class-lt-myclass-gt-in-interface-builder-file-quot-error-at-runtime>Cadmus
C
1

This drove me nuts for a bit and none of the suggestions above helped me get rid of the error. Luckily I only had one IB object using the class so I just deleted it and added it back with the same class specified. Error went away...

Carrie answered 12/11, 2009 at 22:34 Comment(0)
W
1

I added the file Under Build Phase in Targets and the issue got resolved. For the steps to add the file, see my answer at:

Apple Mach-O Linker error (APActivityIcon)

Wimple answered 12/11, 2009 at 22:34 Comment(0)
B
1

In my case I had deleted a class called "viewController" not realising it was selected with the storyboard's identity inspector (under 'Custom Class' up the top).

You just have to simply select the correct class for the view controller in your identity inspector's Custom Class field or add a new class to your project and select that one as your Custom Class.

Worked for me!

Bolanger answered 12/11, 2009 at 22:34 Comment(0)
E
1

I had "Unknown class RateView in Interface Builder" where RateView was a subclass of UIView. I had dropped a UIView onto my Storyboard scene and changed the Custom class field to RateView. Still, this error appeared.

To debug, I changed the name of my class to RateView2 and changed all references to match except the Custom class field of the UIView. The error message still appeared as before with RateView as the missing class. This confirmed that the error message was related to the value of the Custom class field. I changed this value to RateView2 and the error message changed to "Unknown class RateView2 in Interface Builder". Progress of sorts.

Finally, I inspected the source code files themselves in the File Inspector. There I discovered that the source code file (which I had copied from a tutorial) was not associated with my Target. In other words, it had no Target Membership. I checked the box that made the class's source code file a member of the target app and the error message went away.

Eskridge answered 12/11, 2009 at 22:34 Comment(0)
T
1

In my case it was because I declared a subclass of a subclass of a UITableView cell in the .h file (the declaration of both subclasses were in the same .h file), but forgot to make an empty implementation of that second subclass in the .m file.

don't forget to implement any subclass of a subclass you declare in the .h file! sounds simple, but easy to forget because Xcode will do this for you if you are working with one class per .h/.m file.

Tetraspore answered 12/11, 2009 at 22:34 Comment(0)
P
1

In my case I got this error because I'd tried to save some work by creating a new project and then deleting several of the source files and copying over the source files of the same name from the working project. I also copied my MainStoryBoard file which was looking for my RootViewController. However, when I had deleted the original RootViewController and then added in the RootViewController from the previous product, evidently the Add Files operation failed to "check" the target box as suggested above. By merely visting all of the newley imported ".m" files and making sure that the target membership box was checked, all was well. I think what was happening was that the storyboard file was looking for a class that had been "excluded" from the link because the target membership was unchecked. Making sure the required files for the target are so designated in the target membership in the file inspector did the trick. Thanks Pat! (see above)

Photogenic answered 12/11, 2009 at 22:34 Comment(0)
P
1

I had this error crop up today when converting my aaLuminate app to Universal under Xcode 4. This app is based on the utility template and was originally built under Xcode 3.

To save time I copied the iPhone Main and Flipside Views across to appropriate names on the Universal app. I experienced the "Unknown class x in Interface Builder file" error. In my case it was nothing in the XIB files or targets.

I had also copied the aaLuminate-Info.plist file across for other reasons - this had an old key "Main nib file base name" set to MainWindow.

As soon as I deleted this key it fixed the problem!

Peculation answered 12/11, 2009 at 22:34 Comment(0)
B
0

In my case, the class couldn't be found because it was a classed defined in an extension inside the framework like so:

extension Buttons {
    public class MyButton: UIButton {
        // ...
    }
}

When I extracted the class from the extension, the Storyboard could finally find the class (MyFrameworkButton):

extension Buttons {
    public typealias MyButton = MyFrameworkButton
}

public class MyFrameworkButton: UIButton {
    // ...
}
Buckshot answered 12/11, 2009 at 22:34 Comment(0)
B
0

After trying most of the suggestions here wihtout success, I just renamed my class and then renamed it manually in the xib file (with open as source code). Problem then went away.

Brag answered 12/11, 2009 at 22:34 Comment(0)
M
0

In my case problem was a dead IBOutlet link. Once this was fixed everything was good again.

Motoneuron answered 12/11, 2009 at 22:34 Comment(0)
S
0

I keep having this error with WatchKit over and over again and it seems to be when there is a user interface element that isn't tied to an outlet in code. I guess this is required in WatchKit.

class InterfaceController: WKInterfaceController {
    @IBOutlet weak var table: WKInterfaceTable!
}

Important note: just connect the outermost element. For instance if you try to also give a connection for something within the table like a label inside a row you will get a compiler error saying the outlet is invalid and cannot be connected to repeating content.

Singhalese answered 12/11, 2009 at 22:34 Comment(0)
U
0

In my case, the custom UIView class is in an embedded framework. I changed the custom UIView header file to "project" to "public" and include it in the master header file.

Unstopped answered 12/11, 2009 at 22:34 Comment(0)
A
0

In my case I had used a storyboard from another project. After looking at the storyboard file xml (e.g. in TextWrangler) I noticed that one of the "customModule" xml attribute values for a controller was wrong (it was still referencing the old project). Manually changing this fixed the problem.

Ambiguous answered 12/11, 2009 at 22:34 Comment(0)
U
0

In my case was a misspelling "Custom Class" name. Make sure that you check your storyboard for the custom classes that you defined.

Upsetting answered 12/11, 2009 at 22:34 Comment(0)
Y
0

This “Unknown class in Interface Builder file” error at runtime come if you have more then one StoryBoard and one of the StoryBoard using the which is not really exists.

Yoho answered 12/11, 2009 at 22:34 Comment(0)
B
0

In my case I get this error message by a very stupid mistake by me: on interface builder I wanted to set the identifier of a UITableViewCell, but I typed the identifier accidentally to the 'Custom class' entry in interface builder.

I made cells 1000 times before....

Breviary answered 12/11, 2009 at 22:34 Comment(0)
D
0

Per Apple Documentation

For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags.

In short add -all_load to "other linker" flags in your "Build Settings" and you should be good.

http://developer.apple.com/library/mac/qa/qa1490/_index.html

Darter answered 12/11, 2009 at 22:34 Comment(0)
S
0

I had this issue when I had made a new project with the same name and had run them both in the simulator. I renamed one of the projects, deleted the app in the simulator, then ran a clean and re-build.

Storied answered 12/11, 2009 at 22:34 Comment(0)
J
0

A lot of answers here but none was the solution, I tracked it down to the storyBoard where the controller had an Invalid custom class (class does not exist after I renamed it)

Jehu answered 12/11, 2009 at 22:34 Comment(1)
Renaming seems to be the cause. I only get the error after renaming classes. But then, there seems to be no way to link the class to the view again. Even renaming it back to the old name does not help.Preconceive
T
0

This problem happened to me when I added a picker view and then removed it. In case it will help someone, here's how I solved it finally:

  1. Open Document Outline at XCODE (don't know what is Document Outline? I didn't also - google it.. :) ).

  2. Find the Scene that makes the warning message appear, in the document outline window.

  3. On the problematic scene, stand (click) on View, and then in the Utility (google it) window select the Identity inspector tab and change back the custom class name to default UIView.

That't it. :)

Threefold answered 12/11, 2009 at 22:34 Comment(0)
P
0

I saw this error when I changed a class name, despite updating all relevant .h and .m. Turned out, I had missed updating 'customClass' value in the .storyboard files. That resolved the problem.

Possessive answered 12/11, 2009 at 22:34 Comment(0)
M
0

From interface builder/storyboard is referred to a class that is not available.

If the is a known class it is not linked.

If the is not a class or just some characters it is probably a typo. In that case check all the fields in the view controller for this 'unknown class'. In the 'Identity Inspector' (3rd from left in the block 'Custom Class' is one field 'Class' which probably contains the wrong value. Normally it lists the field type (UIView / UILabel etc).

Malleus answered 12/11, 2009 at 22:34 Comment(0)
H
0

I tried most of the solutions you guys suggested above but to no avail. After reading the solution from user776904's I suspected I was having the same issue as I had rebuilt my app from the ground up but copied the xib files from the previous project. I suspected the xib file had a reference to the old project that was causing my error so I simply deleted my mainwindow_ipad.xib file and copied in a new one from a clean new project. This solved it. And I was not game enough to start changing bits of the xib file in its source code.

Helmsman answered 12/11, 2009 at 22:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.