Xcode ios 未知类型名称?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13280314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode ios Unknown type name?
提问by Fabio
I have a question about the following error "Unknown type name VistaDereIzq
"
我对以下错误有疑问“ Unknown type name VistaDereIzq
”
I have a view called VistaDereIzq
. And I do the following to add that view in this view.
我有一个名为VistaDereIzq
. 我执行以下操作以在此视图中添加该视图。
#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
回答by justin
You probably have a circular dependency/include. Use a forward declaration (@class MONClass;
) rather than #import
ing 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).
您可能有循环依赖/包含。使用前向声明 ( @class MONClass;
) 而不是#import
ing 标头。由于没有物理依赖性,您应该首先使用前向声明(即更快的构建)。
So instead of:
所以而不是:
#import "VistaDereIzq.h"
use:
用:
@class VistaDereIzq;
and then add your #import
to an .m
file as needed.
然后根据需要将您的添加#import
到.m
文件中。