未读取类…未知类型名称
我不确定发生了什么或者我改变了什么,但突然之间我试图引用“那是在项目树中”和文件夹中(当我“在finder中显示”时)不是正在阅读……我在同一行代码中遇到了多个错误[见附件]。
请帮忙!!!
当我尝试将HomeViewController.h导入到我的MainContainerViewController中时会出现此问题
作品:
#import #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;
等等
破碎:
#import #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;
等等
您可能有一个标题导入周期。
加
@class MainContainerViewController2;
就在此之前
@interface HomeViewController2
它应该解决这个特定的问题。
根据经验,如果您没有绝对需要,则不应在标题中#import标头,即。 一个超类标题。 如果需要使用类,请使用@class声明它,而不是导入类头。 这样做,99%的时间你都应该安全。
该文件可能未包含在您正在构建的目标中。
尝试检查MainContainerViewController2目标。
单击MainContainerViewController2 .m和.xib并选中Utilities面板(View> Utilities> Show File Inspector),如果勾选了Target Membership部分。
首先检查你的MainContainerViewController2.h文件是否非常小心,看看文件中是否有任何任意的字符。