在我的 Objective-C 项目中,我有一个奇怪的功能,可以说,我有一个类,如下所示:
#import <Foundation/Foundation.h>
@interface Convert /* : NSObject */ // <--- is that necessary?
+(int) toInt:(id) obj;
@end
@implementation Convert
+(int) toInt:(id) obj
{
return [obj intValue];
}
@end
发生的情况是,当我单步执行代码时它工作正常,但我在控制台中收到一个神秘错误(即使代码完全正常,按预期工作):
2010-11-03 09:35:49.422 Tests[14066:5f03] *** NSInvocation: warning: object 0x9e424 of class 'Convert' does not implement methodSignatureForSelector: -- trouble ahead
2010-11-03 09:35:49.422 Tests[14066:5f03] *** NSInvocation: warning: object 0x9e424 of class 'Convert' does not implement doesNotRecognizeSelector: -- abort
然而,即使它说中止,代码仍然有效。但是,当我在没有单步执行这些代码行的情况下运行它时,它会中止。发生了什么,为什么?