【发布时间】:2011-04-10 15:59:15
【问题描述】:
所以我在 iPhone 上工作,一切进展顺利。除了最后两个小时。我正在编辑一些类,然后保存并构建,突然在另一个类实现文件中出现大量错误。似乎所有错误都与类成员(变量)有关,因为我唯一的错误是“对象未声明”,这些对象是类成员。语法没问题,所以我相信它不是那样的。以前有人遇到过这个问题吗?
例子:
Foo.h
@interface Foo : NSObject
{
@private
int m_1;
NSString *m_2;
NSDictionary *m_3;
}
-(id) init;
-(void) dealloc;
-(int) bar;
-(int) barWithFoo:(Foo *)foo;
@end
Foo.m
#import "Foo.h"
@implementation Foo
-(id) init
{
return self = [super init];
}
-(void) dealloc
{
// code
}
-(int) bar
{
if (m_1 > MAX_DECL) /* error here, m_1 undeclared */
{
// do stuff
}
NSLog(m_2); /* error here, m_2 undeclared */
}
// etc...
@end
【问题讨论】:
-
您能在搜索路径中的某处再添加一个
Foo.h吗? -
你能用你为你的问题编写的代码重现问题吗?如果没有,我们需要查看产生错误的实际代码。
-
另外,请注意 Xcode 4 在 NDA 下,所以我们不能在这里谈论它。如果其中有什么问题,请在 Xcode 3 中尝试,如果可行,您应该提交一个关于 4 的错误。bugreport.apple.com
标签: iphone objective-c xcode xcode4