2 つの異なるメソッドから取得したデータを比較しようとしています。1 つはインスタンス メソッドから、もう 1 つはクラス メソッドから取得したものです。理解できない警告が 1 つとエラーが 1 つ表示されます。
これはインターフェースです:
@interface RadioStation : NSObject {
NSString *name;
double frequency;
char band;
}
+(double) maxFMFrequency;
-(void) chackFrequency;
@end
これは実装です:
@implementation RadioStation
+(double) maxFMFrequency {
return 107.9;
}
-(void) chackFrequency {
switch (band) {
case 'F':
if (self.frequency > [[self RadioStation] maxFMFrequency] ) // in this line i get the warning and the error massage
frequency=107.9;
break;
@end
そして、これは私が得る警告です:
instance method '-RadioStation' not found (return type defaults to 'id')
そして、プログラムをビルドして実行すると、エラーが発生します:
Thread 1: signal SIGABRT
私が間違っていることを誰かが知っていますか?
ありがとう!