我所看到的其他职位,但我不知道他们在说什么。我刚开始使用Xcode,它对我来说是新的。警告只是说 “的语义问题未完全执行”未完全执行警告
#import <Foundation/Foundation.h>
#import "classOne.h"
@implementation classOne <------ this is where I get the Warning
-(void) print
{
NSLog(@"I am %i years old, and weigh %i lbs.", age, weight);
}
-(void) setAge:(int) a
{
age = a;
}
-(void) setWeight: (int) w
{
weight = w;
}
@end
然后.h文件低于:
#import <Foundation/Foundation.h>
@interface classOne : NSObject {
int age;
int weight;
} //Person: NSObject
-(void) print;
-(void) setAge: (int) a; //same as void setAge(int a);
-(void) setWight: (int) w; //same as void setWeight(int a);
@end
的主要文件是下面这样:
#import <Foundation/Foundation.h>
#import "classOne.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
classOne *Trenton;
Trenton = [classOne alloc]; //reserves memory for the object Trenton
Trenton = [Trenton init]; //initalizes the object
[Trenton setAge: 25];
[Trenton setWight: 230];
[Trenton print];
//[Trenton release]; //release frees any memory we borrowed from alloc
}
return 0;
}
它可能意味着你的classOne.m中缺少classOne.h – 2013-02-22 21:11:33
宣称可以提供wanring文本的方法。我怀疑你缺少部分属性。 – madmik3 2013-02-22 21:12:39
单击带有感叹号的黄色三角形标记。然后点击“在问题导航器中显示”,xcode会告诉您在实现类时缺少的内容。 – 2013-02-22 21:23:23