私は現在、Objective-C を第一言語として独学しています。大変さはわかりますが、私は物静かで根気のいる人間です。Apple Objective-C のドキュメントに関する演習を開始しました。私の目標は、一般的な Hello World の挨拶ではなく、自分の名前と姓をプログラムからログアウトさせることです。
Use of Undeclared identifier エラーが繰り返し発生します。エラーの原因を突き止めようとしています。
これがintroClass.hです
#import <UIKit/UIKit.h>
@interface XYZperson : NSObject
@property NSString *firstName;
@property NSString *lastName;
@property NSDate *dateOfBirth;
- (void)sayHello;
- (void)saySomething:(NSString *)greeting;
+ (instancetype)person;
-(int)xYZPointer;
-(NSString *)fullName;
@end
IntroClass.m はこちら
#import "IntroClass.h"
@implementation XYZperson
-(NSString *)fullName
{
return[NSString stringWithFormat:@" %@ %@", self.firstName, self.lastName];
}
-(void)sayHello
{
[self saySomething:@"Hello %@", fullName]; //use of undeclared identifier "fullName"
};
-(void)saySomething:(NSString *)greeting
{
NSLog(@"%@", greeting);
}
+(instancetype)person{
return [[self alloc] init];
};
- (int)xYZPointer {
int someInteger;
if (someInteger != nil){
NSLog(@"its alive");
}
return someInteger;
};
@end