The class cannot be read ... Unknown type of name

I'm not sure what is happening or what I changed, but all of a sudden the class that I try to reference โ€œthat is in the project treeโ€ and in the folder (when I โ€œshow in finderโ€) is not readable at all ... I get a few errors in one line of code [see attached].

enter image description here

Please, help!!!


The problem occurs when I try to import HomeViewController.h into my MainContainerViewController

Works:

#import <UIKit/UIKit.h> #import "ViewController.h" @interface MainContainerViewController : UIViewController { ViewController *parent; NSString *FACING; IBOutlet UIView *container; IBOutlet UIView *topNav; IBOutlet UIButton *homeBTN; IBOutlet UIImageView *homeImg; IBOutlet UILabel *homeLabel; IBOutlet UIImageView *seperator1; IBOutlet UIButton *bookmarksBTN; IBOutlet UIImageView *bookmarksImg; IBOutlet UILabel *bookmarksLabel; IBOutlet UIImageView *seperator2; IBOutlet UIButton *favouritesBTN; IBOutlet UIImageView *favouritesImg; IBOutlet UILabel *favouritesLabel; IBOutlet UIImageView *seperator3; IBOutlet UIButton *notesBTN; IBOutlet UIImageView *notesImg; IBOutlet UILabel *notesLabel; IBOutlet UIImageView *seperator4; IBOutlet UIButton *fontBTN; IBOutlet UIImageView *fontImg; IBOutlet UILabel *fontLabel; IBOutlet UIImageView *seperator5; IBOutlet UIButton *settingsBTN; IBOutlet UIImageView *settingsImg; IBOutlet UILabel *settingsLabel; NSString *drawerIsAnimating; //SETTINGS (LOCAL) NSString *fontSize; 

and etc.

Brocken:

 #import <UIKit/UIKit.h> #import "ViewController.h" #import "HomeViewController.h" @interface MainContainerViewController : UIViewController { ViewController *parent; NSString *FACING; IBOutlet UIView *container; IBOutlet UIView *topNav; IBOutlet UIButton *homeBTN; IBOutlet UIImageView *homeImg; IBOutlet UILabel *homeLabel; IBOutlet UIImageView *seperator1; IBOutlet UIButton *bookmarksBTN; IBOutlet UIImageView *bookmarksImg; IBOutlet UILabel *bookmarksLabel; IBOutlet UIImageView *seperator2; IBOutlet UIButton *favouritesBTN; IBOutlet UIImageView *favouritesImg; IBOutlet UILabel *favouritesLabel; IBOutlet UIImageView *seperator3; IBOutlet UIButton *notesBTN; IBOutlet UIImageView *notesImg; IBOutlet UILabel *notesLabel; IBOutlet UIImageView *seperator4; IBOutlet UIButton *fontBTN; IBOutlet UIImageView *fontImg; IBOutlet UILabel *fontLabel; IBOutlet UIImageView *seperator5; IBOutlet UIButton *settingsBTN; IBOutlet UIImageView *settingsImg; IBOutlet UILabel *settingsLabel; NSString *drawerIsAnimating; //SETTINGS (LOCAL) NSString *fontSize; 

and etc.

+4
source share
4 answers

You may have a header import loop.

Add

 @class MainContainerViewController2; 

before

 @interface HomeViewController2 

He must solve this specific problem.

As a rule, you should not # import headers into headers unless you absolutely have to do this, i.e. superclass header. If you need to use a class, declare it with @class instead of importing the class header. Do this and you should be safe in 99% of cases.

+8
source

The file cannot be included in the target you are creating.

0
source

Try checking the target of MainContainerViewController2.

Click on MainContainerViewController2.m and .xib and go to the Utilities panel (View> Utilities> Show File Inspector) if the checkbox is selected in the Target Membership section.

0
source

First, VERY CAREFULLY check your MainContainerViewController2.h file to see if there are any backward characters anywhere in the file.

0
source

All Articles