Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode ios Unknown type name?

I have a question about the following error "Unknown type name VistaDereIzq"

I have a view called VistaDereIzq. And I do the following to add that view in this view.

#import <UIKit/UIKit.h> 
#import <MessageUI/MessageUI.h>
#import "VistaDereIzq.h"
#import "ViewController.h"

@interface VistaNavegador : UIViewController  <UIWebViewDelegate>
{ 
    VistaDereIzq *VistaIzq2;   <----- "Unknown type name VistaDereIzq"
}

@end
like image 982
Fabio Avatar asked Nov 07 '12 23:11

Fabio


1 Answers

You probably have a circular dependency/include. Use a forward declaration (@class MONClass;) rather than #importing the header. Since there is no physical dependence, you should be using a forward declaration in the first place (i.e. for much faster builds).

So instead of:

#import "VistaDereIzq.h"

use:

@class VistaDereIzq;

and then add your #import to an .m file as needed.

like image 153
justin Avatar answered Nov 19 '22 00:11

justin