[英]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.