Reputation: 1872
I'm unsure what is going on or what I changed, but all of a sudden a class I'm trying to reference "that is in the project tree" and in the folder (when I "show in finder") isn't being read at all ... I get multiple errors on the same line of code [see attached].
Please Help!!!
The issue 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;
etc.
Broken:
#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;
etc.
Upvotes: 4
Views: 5065
Reputation: 5558
You may have a header import cycle.
Add
@class MainContainerViewController2;
just before
@interface HomeViewController2
It should solve that particular issue.
As a rule of thumb, you shouldn't #import headers in headers if you do not have an absolute need to do so, ie. a superclass header. If you need to use a class, declare it with @class instead of importing the class header. Do that and you should be safe 99% of the time.
Upvotes: 8
Reputation: 47699
First check VERY CAREFULLY your MainContainerViewController2.h file to see if there are any wayward characters anywhere in the file.
Upvotes: 0
Reputation: 4306
Try to check MainContainerViewController2 target.
Click on MainContainerViewController2 .m and .xib and check in the Utilities panel (View > Utilities > Show File Inspector) if the checkbox is ticked into Target Membership section.
Upvotes: 0