I was working on an Xcode project and everything was going great, until two of my classes stopped recognizing each other. Here is an excerpt:
#import "JBXViewController.h"
@interface ViewController2 : UIViewController {
JBXViewController *jbx;
}
For some reason I get the error “Unknown type name ‘JBXViewController’; did you mean ‘UIViewController’?” I don’t understand how this is possible, since I’m importing the other class just a few lines above. Any insights would be much appreciated!
When you say they “can’t see each other”, I assume you mean you are also importing ViewController2.h in your JBXViewController.h. So you have one header importing another header, which imports the first header, which imports the second, which imports the first again…
Instead, use a forward reference to JBXViewController:
And then
#import "JBXViewController.h"in your implementation instead (in your ViewController2.m)