[英]Why is Xcode telling me this variable is undeclared?
我在Xcode中遇到以下错误,我知道我需要声明filteredChildren
所以我尝试将NSArray *filteredChildren
行添加到头文件中,但这只会让事情变得更糟。 我需要将哪些代码添加到 delcare filteredChildren
的标头中?
您的标题应该看起来像这样:
@interface SomeClass {
NSArray *filteredChildren; // this should fix the compiler error
}
// If the filteredChildren method is public, add this declaration as well to prevent compiler warnings
- (NSArray *)filteredChildren;
@end
看不到代码,但要确保在函数之后打开和关闭所有大括号,知道这可能会导致问题,并且可以轻松完成大型项目。
int a = 1;
void example ()
{ if (exampleVar = 1 {
a = 2; // not declared error
}
int a = 1;
void example ()
{ if (exampleVar = 1 {
a = 2; // should be declaring
}
}
检查所有头文件和类层次结构以确保您没有两次声明头文件或同一个类,这会在您创建类的实例并使其未声明时产生影响。
如果不是这种情况,请尝试清理/重置您的编译数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.