objective-c – 未读取类…未知类型名称

前端之家收集整理的这篇文章主要介绍了objective-c – 未读取类…未知类型名称前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我不确定发生了什么或者我改变了什么,但突然之间,我试图引用“那是在项目树中”和文件夹中(当我“在finder中显示”时)不是正在阅读……我在同一行代码中遇到了多个错误[见附件].

请帮忙!!!

当我尝试将HomeViewController.h导入我的MainContainerViewController时会出现此问题

作品:

#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;

等等

破碎:

#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;

等等

解决方法

您可能有一个标题导入周期.

@class MainContainerViewController2;

就在此之前

@interface HomeViewController2

它应该解决这个特定的问题.

根据经验,如果你没有绝对需要,你不应该在标题中#import标题,即.一个超类标题.如果需要使用类,请使用@class声明它,而不是导入类头.这样做,99%的时间你应该安全.

猜你在找的Xcode相关文章