0

我用这个 init 方法子类化 CCMenuItemImage

-(id)initWithChildren:(id)targetedApplication {
    if(self = [super initFromNormalImage:@"Answer_Box.png" selectedImage:@"Answer_Box.png" disabledImage:@"Answer_Box.png" target:targetedApplication selector:@selector(answerButtonTapped:)] ) {
            NSLog(@"Yes?");
            return self;
    }
    return self;

}
-(void)answerButtonTapped:(id)stuff {
    NSLog(@"Answer Button Tapped");
}

并且每次在控制台中出现此错误时都会崩溃

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil'

提前感谢您的帮助。

4

1 回答 1

1

-answerButtonTapped 是targetedApplication 的一种方法吗?应该是那个。该错误表示目标中没有这样的功能。或者你可以传递“self”而不是“targetApplication”

于 2012-09-06T09:16:03.747 回答