我正在尝试比较从两种不同方法获得的数据:第一个来自实例方法,第二个来自类方法。我收到一个难以理解的警告和一个错误。
这是界面:
@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
有谁知道我做错了什么?
谢谢!