622

I upgraded to Xcode 6 beta 4 and now my App continuously crashes with the message

Unknown class X in Interface Builder file.

It crashes because supposedly Xcode can't find my custom classes that I have linked in my Storyboard but it shows that they are linked correctly in the Xcode interface.

I'm positive everything is linked correctly. My only other option may be to delete the entire storyboard file and start from scratch because it might be corrupted somehow.

Edit: I would also like to add that I tried cleaning, reseting simulator, messing with build phases etc. None of that works.

Cœur
  • 32,421
  • 21
  • 173
  • 232
Epic Byte
  • 33,169
  • 12
  • 40
  • 88
  • Possible duplicate of http://stackoverflow.com/questions/3416269/unknown-class-in-interface-builder-file – Bouke Jul 24 '14 at 05:20
  • 1
    @ImreKelényi You are right. This happened to me again recently after doing what you just described. – Epic Byte Aug 22 '14 at 18:59
  • This worked for me, http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime – vrunoa May 12 '15 at 22:34
  • It was typo for me, debug it to the Control element, till when it comes, select; View Controller > identity inspector > Custom Class > Class. delete that if that class is not defined. – mavericks Sep 30 '15 at 09:50
  • 9
    PLEASE NOTE! This "error" can stem from different origins. If the accepted answer does not work for you then move down and try the next answer. The correct answer for my situation was the 5th answer. – Jacksonkr Feb 10 '16 at 16:31
  • If you're here because of the TextFieldEffects library (https://github.com/raulriera/TextFieldEffects/tree/1.1.1) like me, note that this solved my problem. – rigdonmr Apr 10 '16 at 20:18

52 Answers52

1491

I resolved this issue as I was typing the question. I figured I'd answer my question and leave it here for anyone else who may face this issue when using Xcode 6 beta 4.

To resolve this issue, you need to select each of your custom class objects in Storyboard (this includes any custom views, even the custom view controllers themselves).

Then with those objects selected, open the identity inspector and under "Custom Class" you should see the Module option. Click inside the Module text box, and press enter.

That's it! The current module for all of my custom objects must have been internally incorrectly set somehow in Xcode 6 beta 4. But there was no visual indication of this in the inspector.

Note that if pressing enter inside the Module text box doesn't work, try selecting the arrow to the right and manually select your current module, then clear the text box and press enter. You can also try pressing enter inside the class text box (although this usually is to resolve a different issue).

Here is an image to make things more clear: enter image description here

Epic Byte
  • 33,169
  • 12
  • 40
  • 88
  • 71
    For me, clicking inside "Module" and pressing enter did not work consistently, but selecting the "Class" field (and pressing enter) always did the job. – Imre Kelényi Aug 22 '14 at 14:54
  • I was getting this error and it happened to be because I changed my app name so all the modules were wrong. – jamespick Aug 26 '14 at 18:53
  • 1
    @itedi good point, when I get a chance I think I'll add a "Causes" section and list everything that users report caused the issue so we can get a list of what's leading to the issue. – Epic Byte Aug 26 '14 at 18:59
  • gfrs: This is not working for me... Have you tried with Xocde 6 beta 6? – Nitin Sep 04 '14 at 04:51
  • Doesn't work in the GM. What works is typing your module name manually. – Maciej Swic Sep 13 '14 at 09:20
  • What about nibs that are shared between two different build targets, in which case there are two different Swift modules? Is the only solution to port the shared code and resources over to their own module (thereby limiting to iOS 8)... – FluffulousChimp Sep 27 '14 at 11:19
  • 2
    For me, the target was set correctly, but the class still didn't show up in IB. I noticed, though, that the "Location" of the file showed a path "Relative to Project" instead of "Relative to Group". Removing the file reference AND the group and re-adding it in the project root worked for me. – knl Oct 20 '14 at 20:14
  • 1
    I have yet to find a solution. This might be the most frustrating bug I've ever encountered. – Ryan Smith Oct 24 '14 at 07:55
  • 8
    Wow. Thanks for this, I don't think I would have got there otherwise. This fixed an issue that started happening after I added `@objc(...)` to one of my Swift classes. – ndbroadbent Nov 07 '14 at 21:57
  • 1
    The solution was different for me. You need to add the .m of the class to the build phase compiled sources of the target. – Ruud Visser Mar 23 '15 at 21:09
  • 1
    This error was caused for me by creating a new class and subclassing it from an already existing class I created. Not sure why that would cause that though. – SamG Mar 26 '15 at 21:36
  • I got the same issue but I only get the error message in console log without the app crash. And I've tried your solution, but my module name is empty so I've no choice but to leave it. Strange – Alfro Apr 27 '15 at 12:27
  • My "Module" field wasn't causing problems. I only had issues with "Class" field, as my class was not selected properly due to copy-paste. After selecting the correct class for "Class" field had no more problems. – Andrej Jun 15 '15 at 07:10
  • In my case, I had not added the `.m` file of the custom class to the **Compile Sources** list of my target. – oarfish Jun 21 '15 at 08:00
  • for me, I had to manually drag and drop the implementation .m file in the "Compile Sources" section of Build Phases. – sudoExclaimationExclaimation Jul 12 '15 at 02:37
  • I was four hours into the rabbit hole when I finally found this post. Thank you so much. I almost gave up. – Pete Varley Aug 30 '15 at 03:24
  • @EpicByte I am using 6.3. And an xib I created somehow decided it was too cool to have the module set for it. Don't know what i would've done without your answer! – Rajeev Bhatia Oct 01 '15 at 12:17
  • Xcode sometimes puts source files in Base.lproj (when creating, or when copy to project if needed is checked when drag and dropping) and this prevents the file from being added to compiled sources, once clean that up, and add it to compiled sources, you must click the class name and hit enter as noted in other comments – owenfi Nov 03 '15 at 21:22
  • It is the end of 2015 right now, and this still worked like a charm! Thank you so much!!! – Sonic Master Dec 04 '15 at 10:40
  • 2
    Works for XCode 7.1.1 too – z22 Dec 16 '15 at 11:27
  • 12
    This issue is still present in XCode 7.2. This solution worked. – Tom Fast Dec 17 '15 at 17:39
  • In my case in xCode7.2 this wasn't a conversion issue but popped up when I created a custom UIViewController class and named it incorrectly initially. Not sure it's related, but the solution worked. – Opus1217 Jan 19 '16 at 02:36
  • Epic answer by @EpicByte (y). Very easy way to find the root cause of problem and get fixed(of course). – pkc456 Feb 09 '16 at 10:56
  • In my case I had the custom class in a local framework, and clicking enter in the module field didn't work. I had to manually select the framework in the module field for it to work. – timgcarlson Feb 22 '16 at 21:23
  • 1
    I had to clear out and reenter the name of my custom class, then it found the module correctly. WThis is with XCode 7.2 as well. – Tony Heupel Feb 29 '16 at 18:47
  • do you guys know what exactly has to be written in the Module field ? Selecting/Deselecting/Reselecting the Class field doesnt change the module field at all. And btw, any of my other VCs have the module set, they all have "None" causing no problem. Why should this one have it ? – omarojo Apr 19 '16 at 22:34
  • 1
    Just ran into this on Xcode 7.3 solution worked beautifully. – zic10 Apr 28 '16 at 02:36
  • 1
    does not work for xcode 7.3.1, with swift component in objective-c project – Ahd Radwan May 29 '16 at 08:57
  • 1
    I just got bit by this AGAIN. I had forgotten about it and spent another couple hours thinking I had hooked a nib up incorrectly or something. Still happens in Xcode 7.3.1!! – Paul Bruneau Jun 03 '16 at 19:01
  • this worked for me to get rid of the warning/error although i noticed that at least the background color specified in my storyboard did show up in the running app despite this console log – Alex Bollbach Jul 26 '16 at 04:45
  • Thank you thank you. For posterity, this occurred in my project when I renamed the app. The module name is not updated to the new app name so its trying to reference the class in the old project. It manifested as an unwind segue not firing. – John Armstrong Aug 14 '16 at 04:24
  • You saved my life. Until xcode 8.2.1 have this problem. I found that it add some parameters into xib file. (Marked with highlight) – Johnny Jan 20 '17 at 06:08
  • Thank you! My app has multiple targets so I needed to press "enter" in the Module field in order to set it to "Current - (target name)" – Vee Feb 14 '17 at 06:07
  • 1
    This is still an issue in Xcode 8.2.1. Thanks for the helpful answer! – BigSauce Mar 19 '17 at 06:24
  • 3
    This is still an issue in Xcode 8.3.1... such a shame – Sepehr Behroozi Apr 09 '17 at 12:48
  • 1
    Xcode 8.3.3 user here, thanks, it solved my problem. – gabicuesta Aug 09 '17 at 11:25
  • 2
    Xcode Version 9.0 beta 6 and the issue isn’t fixed – Rafael Bugajewski Sep 04 '17 at 11:58
  • Note that if you're using Carthage, the dropdown for Module may not show anything but you can just manually type in the name of the module and it'll work – NSExceptional May 11 '18 at 04:16
  • 2
    Wow this was answered in 2014 and I still found it happened in June 2018 – Wayneio Jun 30 '18 at 09:24
  • 1
    You saved my life. The actual problem was we have to Tick `Inherit Module From Target` option in the storyboard file. – viper Sep 24 '18 at 08:47
  • 1
    XCode 10.0 user here – Chris Allinson Oct 13 '18 at 23:36
  • When I hit the 'return key' on the custom class it clears out the module to be empty (just on this one scene in the storyboard). and then the module drop down is empty (although I have 2 targets that work with all my other view controllers). Maybe it has something to do with using this storyboard and the class that is not recognized is an objective-c class, whereas the rest of the project is in swift. – aman Mar 13 '19 at 20:31
  • Enabling `Inherit Module From Target` took the correct target module – Arnab Apr 09 '19 at 13:16
  • Xcode normally checks the box for you if you change then class - sadly if you use a find and replace it doesn't - Thanks for your post – RichAppz Jun 26 '19 at 10:19
  • Oh my... I don't know how I would have figured this out without this post! THANK YOU! This worked for me just now after I converted a custom TableViewCell from Objective C to Swift in Xcode 11. – Erik van der Neut Sep 24 '19 at 10:27
  • It's 2020, I'm on Xcode 11, and this is still happening. Thank you for this solution though! – Animator Joe Jan 12 '20 at 22:58
100

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">
noɥʇʎԀʎzɐɹƆ
  • 6,405
  • 2
  • 38
  • 63
ChikabuZ
  • 9,226
  • 5
  • 60
  • 79
72

I had this problem after renaming a swift class. Solved it by using the @objc directive:

@objc(ForumTopicListViewController) class ForumTopicListViewController
user1760527
  • 1,083
  • 8
  • 12
  • 4
    This fixed it for me, I had `@objc class X` and changing to `@objc(X) class X` worked. – Joe Oct 29 '14 at 13:25
  • 1
    You can also try to delete your derived data see http://stackoverflow.com/questions/24039932/how-to-delete-derived-data-in-xcode6 – user1760527 Dec 06 '14 at 15:58
  • Had this problem after renaming the default ViewController class from the Single View project template. I wonder what magic was used so that the `@objc()` directive was not needed for the 'original' ViewController class... – Berend Klein Haneveld Dec 11 '14 at 23:59
  • I goes the opposite side. I had specified the module name in Storyboard file but also added @objc directive. – WeZZard Jan 15 '15 at 06:14
  • This worked for me. ObjC/Swift hybrid project. New VC + Xib in Swift. Xib was not working. VC was blank. Added this, works. – John May 10 '15 at 21:14
  • This works, despite having way less upvotes than some other answers. Thank you my saviour! – Fomentia Jun 24 '16 at 15:10
  • Worked for my first Swift class in a hybrid project in Xcode 8. I already had @objc but had to make it @objc(ClassName) class ClassName as described. – Oded Oct 20 '16 at 05:00
  • 1
    Did NOT work for me. :( Neither is the solution of Module name working. – mythicalcoder Nov 05 '16 at 13:20
  • Same problem here. If you have @objc(ForumTopicListViewController) it won't find it in Interface Builder you need @objc FormumTopicListViewController class UIViewController – Frost Oct 28 '18 at 01:25
68

Project with Multiple Targets

In my case I am working on Project with multiple Targets and the issue was "inherit from Target" was unchecked. Selecting "inherit from target" solved my problem

enter image description here

Muhammad Nayab
  • 1,344
  • 12
  • 13
  • Thanks for posting this. Solved the issue I was seeing very quickly. – JaredH Apr 26 '18 at 01:50
  • I had a similar situation. (XCode 9.4.1) I created an iOS app called FilesTestA, with a custom UIView called MxFileView (which consisted of MxFileView.swift and MxFileView.xib). Then I added another target: a Today widget ("FilesTestAWidget"). Solution for using MxFileView in the widget: (1) class = "MxFileView"; (2) check "Inherit Module from Target" (or uncheck it and manually enter "FilesTestAWidget"); (3) in the app target, make sure that both MxFileView.swift and MxFileView.xib include FilesTestAWidget in their Target Membership. – Kenster999 Sep 10 '18 at 18:20
  • This happened to me on a new project from the default template in Xcode 10.1 (a single iOS app target, and 2 test targets). The checkbox was unchecked for all of my custom view controllers (and so the placeholder text was "None"). After going through and checking the checkbox for every custom view controller in my storyboard, the problem was resolved. – Mason Jan 24 '19 at 06:56
59

This worked for me..

Check your compiled source, whether that file(e.g; ViewController.m) is added or not, in my case ViewController file was not added so it was giving me the error..

enter image description here

mavericks
  • 1,559
  • 16
  • 24
  • @CarmenA You only ever add '.m' files to `Compile Sources`. This really is the correct (& only) solution for some. – Jacksonkr Feb 10 '16 at 16:29
  • I tried several of the other solutions with no luck. This did the trick. For some odd reason one target was missing the one source file that was giving me fits. – galactikuh Jan 10 '18 at 13:19
  • for me too.. Happened because of some get conflict resolution – Eldhose Aug 18 '18 at 07:01
46

This can happen in any Xcode above 6.0. It happened to me after renaming some ViewController classes in Swift project (but I guess it will happen with Obj-C too). You just have to open the interface builder, go to Identity Inspector of ViewController that had its class renamed, select class and press Enter. That will reassign renamed class to selected ViewController and also reset Module Value which gets lost after renaming the class.

Update for Xcode 8.1 (probably 8.0 too):

Xcode 8.1 just crashes. Simply and annoyingly just crashes and doesn't print anything. I was chasing that phantom crash for an hour just to find out that it was this very same thing - unassigned class in IB. If you're getting some phantom crashes, double check IB for unassigned classes first.

jovanjovanovic
  • 4,109
  • 3
  • 18
  • 31
  • thanks for this. it appears that following your suggestion causes Xcode to update the module (under the class in IB) from None to Current. i'm thinking the issue is that simply entering the name w/out hitting enter fails to trigger a module update by Xcode. – rockiesGrizzly Dec 12 '16 at 21:40
  • This worked for me. I inadvertently renamed a controller class, so it obviously no longer existed when the view controller was loaded. – Litehouse May 13 '17 at 13:39
43

Enabling Inherit Module From Target took the correct target module. That solved the issue.

enter image description here

Arnab
  • 3,267
  • 1
  • 26
  • 39
32

Sometimes the controller you are providing loses its target membership from the current application. In that case, pressing enter on the "Module" field will do nothing. Go to the controller and make sure that it has target membership set to the current app.

Furqan Khan
  • 494
  • 4
  • 12
31

My answer: set custom Module equal to the custom Pod name (in my example - custom class name) like on the screenshot attached

This solution is for a specific case: for custom views classes from Pod (or Carthage) framework.

Infrastructure: XCode8, Swift3

enter image description here

Tamara
  • 791
  • 9
  • 14
18

I fixed it by doing exactly the opposite of what ChikabuZ suggested (thanks for pointing it out, though). In the storyboard file, find this:

<viewController storyboardIdentifier="StoryboardId" id="SomeID" customClass="CustomClass" customModule="AppName" customModuleProvider="target" sceneMemberID="viewController">

and replace it with this:

<viewController storyboardIdentifier="StoryboardId" id="SomeID" customClass="CustomClass" sceneMemberID="viewController">

I can't believe how many hours I'm losing getting around bugs in the Swift compiler and Xcode 6

Orlin Georgiev
  • 1,126
  • 13
  • 17
18

Selecting the proper Module for my Custom Class I solved this problem .

Here it is :

enter image description here

roy
  • 6,039
  • 3
  • 25
  • 36
13

I faced this problem in Xcode 8, to resolve it I had to modify storyboard in the text editor.

In general, look up for your control and remove customModule and customModuleProvider from control entity.

Did a trick for me.

George Maisuradze
  • 1,654
  • 17
  • 16
11

I had the same problem.

In my case, Xcode wasn't adding my custom class to: Target > Build Phase > Compile Sources.

So I recommend you to verify if your CustomClass.m is there.

enter image description here

I hope this helps you.

rcmstark
  • 994
  • 1
  • 13
  • 18
9

I faced this issue in Xcode 6.1 when I removed Main.storyboard , the LaunchScreen.xib file and the default ViewController classes from my project.

I fixed it by deleting the Launch Screen File and Main Interface entries from Info.plist

Vinay Jain
  • 1,603
  • 20
  • 27
9

Check if your class has right Target Membership.

Jayprakash Dubey
  • 32,447
  • 16
  • 161
  • 169
Jakub Truhlář
  • 15,319
  • 7
  • 65
  • 73
8

I googled everywhere for this. None of the answers work for me until i met 1 dude who asked me to move my project folder to desktop. It just worked automatically. Apparently if you have you project folder to deep in many folders, XCODE actually breaks.

VBaarathi
  • 763
  • 7
  • 12
  • I got this problem in Xcode 7 beta 5 again since I got it in Xcode 6 before. This time, this method works for me. – Jake Lin Aug 21 '15 at 14:37
  • 1
    In visual studio there is a similar problem. But over there, we get a clear warning message saying the path is too long and things cannot be added or edited. Not sure if its the same thing with XCODE, but after that episode i keep all my projects either in documents or desktop and never had this problem again. I even gave this advice to someone using Xamarin Studio and it also worked for them... – VBaarathi Sep 17 '15 at 23:54
8

You need to check the box "Inherit Module From Target" Checkbox

enter image description here

Mike Zriel
  • 1,141
  • 1
  • 12
  • 26
7

These steps work for me.

1) Clear Derived Data.
2) Remove .h and .m files
3) Create .h and .m files Again

ARWIN
  • 126
  • 2
  • 10
  • This worked for me as well. I even made it work without clearing derived data. – jaytrixz Aug 04 '15 at 14:34
  • This was worked for me, thanks a lot Arwin, But still I am not getting that why it's raising such error because I did not modify anything in the class or in IB before – Kirtikumar A. Nov 12 '15 at 16:58
7

I solved this by opening my storyboard file as source code and using command-F to search for my unknown class and delete the custom class associated with it.

Wraithseeker
  • 1,794
  • 1
  • 16
  • 33
6

What @gfrs said is correct, you need to set the Module. However I once ran into an issue that my class wasn't listed in the Class dropdown. Eventually I removed the swift file, re-started Xcode and re-created the file. Finally the class was listed and could be used in Storyboard.

Also have a look at this answer, which looks like to solve the 'real' problem I encountered.

Community
  • 1
  • 1
Bouke
  • 10,025
  • 6
  • 49
  • 88
6

I solved this problem by typing in the Module name (unfortunately the drop list will show nothing...) in the Custom Class of the identity inspector for all the View controller and views.

You may also need to indicate the target provider. To achieve this objective you can open the storyboard in sourcecode mode and add the "customModuleProvider" attribute in both ViewController and View angle brackets.

Teng Long
  • 395
  • 5
  • 12
6

My solution (Xcode 8.1 Swift 3.0):

Unknown class xxx in Interface Builder file.

Open StoryBoard as Source Code and search for xxx. Remove attribute which contains value xxx. Build and Run.

ibrahimyilmaz
  • 2,169
  • 20
  • 27
  • WTF? This was absolutely necessary for me, thank you. I had to delete the `customModule="" customModuleProvider=""` – Dan Rosenstark Jan 11 '17 at 00:00
  • 1
    If we try to publish an application to the app store that contains an error like this, the application is refused without thought. – ibrahimyilmaz Jan 11 '17 at 00:34
  • I disagree. I just submitted a build that I had to modify this way to TestFlight and it's ready for Beta Testing... we shall see what happens on the actual app store, but it's an IB bug IMO. Thanks! – Dan Rosenstark Jan 11 '17 at 01:04
4

In my case, I added a flag -ObjC to Other Linker Flags in project settings to make it work. Also I tried with -all_load flag and it worked well too.

enter image description here

Rostyslav Druzhchenko
  • 3,133
  • 3
  • 29
  • 36
3

In my case, the class referenced in the Storyboard / xib did not have Target Membership set.

To fix, give that class's .h and .m files the same Target Membership as your other classes.

No target membership set.

pkamb
  • 26,648
  • 20
  • 124
  • 157
  • This was my problem, but while trying various solutions I caused the problem that Epic Byte's answer fixes. You must have your source code in the target you are building, but also in IB you need to set the view controller to be part of the current target. – SafeFastExpressive Feb 03 '17 at 22:01
  • Target membership was my problem also, looked everywhere, but thanks to this answer I could solve it. – Borzh Feb 28 '17 at 21:08
3

My solution was to remove @objc from Custom class definition.

2

I faced the problem when I ported the storyboard from Swift project to Objective-c project, noticing vvkuznetsov's answer, it turned out the two project using same identifier. I "Product -> Clean" and tap Enter key on the Module and Class text field. the issue went away.

Community
  • 1
  • 1
xhg
  • 1,551
  • 1
  • 17
  • 32
2

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.

2

My issue was user error. I had a generic UIView in my storyboard and in the Custom Class section of the Identity Inspector I had accidentally changed the name from UIView to gibberish.

All it took to fix was to change it back to UIView.

Scooter
  • 3,807
  • 4
  • 28
  • 44
  • I did the same thing, but I had accidentally added the Custom View Controllers name to the ViewControllers root view's custom class section. So I was looking to see why View Controller wasn't able to be found when it was the root view the whole time. – TMin May 13 '20 at 13:57
1

What only worked for me is actually adding the module name to the xib file...

Sooo, the xib files look like this:

mymodule.MyViewController.xib (Module being the name of the proyect, usually)

HORRIBLE solution in my opinion, but that is supposedly how Apple wants us to do it now.

This question shows 3 possible work arounds back in beta 4 ... apparently Apple has not been very helpful in this situation according to some because they call it "Working as intended."

Community
  • 1
  • 1
S.H.
  • 2,637
  • 3
  • 24
  • 28
1

I had the same problem with Xcode Version 6.1 (6A1052d). I think the problem appears if you renamed your App / Xcode Project.

My solution was to add the module name in the interface builder manually.

patrickS
  • 3,010
  • 3
  • 23
  • 38
1

I had this problem after I added a new target, then created a new class using the 'New File' dialog but accidentally failed to check the new target as well as the original target in the creation dialog, so the object was only added to my original target. The solution was to delete the source files (remove reference only) then add them back using 'Add Files', this time checking both targets.

JulianSymes
  • 2,095
  • 20
  • 24
1

The solution was different for me. You need to add the .m of the class to the build phase compiled sources of the target.

Hope this helps!

Ruud Visser
  • 3,066
  • 2
  • 18
  • 18
1

Select your unknown class file, open file inspector tab, check your target name in Target Membership. There you go.

Nix Wang
  • 795
  • 9
  • 18
1

On me it happend because my project was called with "ä,ü,ö"

SwiftNewling
  • 642
  • 2
  • 18
0

I faced such a problem on Xcode 6 when I deleted the already included ViewController.h & ViewController.m files from my new view based project, and deleted the scene that was related to this class from storyboard, Xcode cashes these files in derived data folder, so if you try to go to Window -> Projects -> your_project and delete the derived data everything will go fine.

JAHelia
  • 4,684
  • 14
  • 52
  • 102
0

Don't use spaces in the project name, otherwise the Custom Class will not find your own classes.

0

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). I wrote my solution there https://stackoverflow.com/a/27763697/1654692

Community
  • 1
  • 1
vvkuznetsov
  • 876
  • 1
  • 7
  • 15
0

It happened to me because my class was marked with @objc and in sotryboard it couldn't find the module. Removing @objc fixed the problem

aryaxt
  • 69,636
  • 87
  • 281
  • 421
0

I had the same problem, but not the same fix.

The project folder was kinda corrupted so i had to copy my project folder to another folder, for example your desktop and after that open the project.

When it opened go to your interface builder project and you will see he recognise your script, Then you click indeed on the name of your script and press enter, u will see the module input will fill it self.

And it will work like a charm! :D

Jippe Joosten
  • 393
  • 1
  • 2
  • 16
0

This worked for me when nothing else did. From the project directory in terminal:

[~/Developer/MyProject] grep -rn ViewController * | grep -i xib 

Open the matched files as source code in Xcode and change any instances of ViewController to what you actually need. In my case the file I needed to open as source was Main.storyboard and I changed instances of ViewController to DetailViewController.

I deleted two files from Xcode and main.storyboard which is what I believe caused this issue for me to begin with.

N R
  • 1
  • 2
0

In mij case the ViewController.h/m where in a lib. The projects still builds but since Xcode 6.3 the above error was shown at run-time. Moving both files back into the project solved the issue.

0

I was playing with Spring class. And this error happend to me because i used folder as reference when moving whole folder class to project instead of creating groups. So this was my solution, dont use folder as reference but create groups.

Goran Jakovljevic
  • 2,162
  • 1
  • 23
  • 23
0

in my case , i setup app as universal app, so xcode creates two storyboards.but i was only using(designed) only iPhone storyboard. and trying to run app in iPad.for resolve problem just need to make app as only for iPhone and works great.

bLacK hoLE
  • 681
  • 1
  • 7
  • 20
0

I had the same problem with Xcode 6.3 when I add files to "myapp". That's because I choose "create folder reference" instead of "create groups".I delete these files and add them again with the "create groups" option.And the problem fixed.

wj2061
  • 1
  • 1
0

For me, I'm using Xcode7 + Swift2

Solved this problem by checking my code, I have this line in my viewController:

 self?.navigationController?.pushViewController(vc, animated: true)

Then I realized that I haven't get navigationController connected to the detail page. So if you're pushing a new ViewController with customized ID, better to check that.

0

My issue was related to a podfile framework (specifically the 'BWWalkthrough'). None of the above solutions worked for me, and no matter how I tried I couldnt get the module to point to my app.

What ended up working for me was removing the library as a podfile and add it directly to my project as a static library. Everything was hunky-dory for me after that. Not entirely sure what was 'broken' with the pod implementation of the class.

Simon
  • 1,895
  • 2
  • 19
  • 25
  • I had the same issue with custom pod - setting Module to the podname helped me, You can find here my answer with illustrating screenshot if needed. – Tamara Mar 13 '17 at 06:16
  • Setting module as `BWWalkthrough` made the messages go for me. – Alexandre G Jun 06 '17 at 07:30
0

In my case the problem was due to having our main storyboard set as the Launch Screen, and I'd get a console error (no crash) at app start for every custom view controller referenced in the storyboard.

We'd covered from XIBs and launch images to storyboards and I hadn't yet gotten around to getting the launch screen working again. When I finally got around to creating a bare bones launch storyboard with no custom view controllers (which aren't allowed) these console errors stopped appearing.

Eric McNeill
  • 1,710
  • 1
  • 16
  • 29
0

For me the problem was that I was referencing a custom class in the storyboard (which matched to a .h file) but I didn't have an @implementation command in the .m file.

theDuncs
  • 4,211
  • 4
  • 35
  • 58
0

Swift 3 solution.

All these did NOT work.

  1. Clicking on Module on right pane did NOT work.
  2. Adding @obj did NOT work.
  3. Restarting did NOT work.
  4. Moving to desktop as xcode breaks for longer path is NOT working. ...

This worked finally.

Just create new directory and create a new project inside that. Add the files except Main.sotryboard.

Now copy the view controllers from previous project and paste it into new Main.storyboard.

Voila ! This works.

mythicalcoder
  • 2,478
  • 28
  • 37
0

I'm a PyObjC user and I had my NSView subclass in its own file. What solved this problem for me was to move the NSView subclass from its own file into my AppController.py file. This is the file that has the application controller in it.

Stephen Rauch
  • 40,722
  • 30
  • 82
  • 105
user1766438
  • 194
  • 1
  • 9
0

This really wierd when XCode 10 stopped to "refine debugs".
In my case, i setted UITableViewDelegate and UITableViewDataSource with Storyboard and forget to implemente those required methods.
I just wanted to test the view first, before implement those methods, then crash! XCode 9, will warning about those methods, but XCode 10, really maked my code slow, not on this one, others i been thru this "error doubt".
Hope this help someone.
Thanks

Daniel Arantes Loverde
  • 2,181
  • 2
  • 26
  • 39
0

For me i've tried all the solutions in this question didn't work , i finally made it by .

copy the pod .h .m files into my project and imported the .h into my project c header.

then i went back to storyboard the class was UICountingLabel i removed it and hit enter ( empty no class ) , then i added it again and hit enter, worked successfully .

Khodour.F
  • 14,342
  • 11
  • 37
  • 73