Ios 触摸中的布尔开始导致NSInvalidArguementException崩溃

Ios 触摸中的布尔开始导致NSInvalidArguementException崩溃,ios,objective-c,crash,boolean,sprite-kit,Ios,Objective C,Crash,Boolean,Sprite Kit,我似乎无法确定下面的代码有什么问题。 我发现BOOL启动时出现以下错误: NSInvalidArgumentException',原因:'-[游戏场景启动]: 已将无法识别的选择器发送到实例0x7fc568e26680 这发生在第一次触摸屏幕时。删除if语句后,应用程序将正常工作 @interface SKScene () @property BOOL isStarted; @end ... ... -(void)start { self.isStarted = YES; [hero sta

我似乎无法确定下面的代码有什么问题。 我发现BOOL启动时出现以下错误:

NSInvalidArgumentException',原因:'-[游戏场景启动]: 已将无法识别的选择器发送到实例0x7fc568e26680

这发生在第一次触摸屏幕时。删除if语句后,应用程序将正常工作

@interface SKScene ()
@property BOOL isStarted;
@end

...
...

-(void)start
{
self.isStarted = YES;
[hero start];
}

...

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (!self.isStarted){
   [self start];
}
else
{
    [hero jump]
}
[hero start]代码如下:

-(void)start
{
SKAction *incrementRight = [SKAction moveByX:1.0 y:0 duration:0.03];
SKAction *moveRight = [SKAction repeatActionForever:incrementRight];
[self runAction:moveRight];

}

它在哪条线上坠毁?if语句的代码看起来不正确。首先,它使用isStarted而不是self.isStarted或_isStarted,因此我对它的编译感到惊讶。其次,它是赋值=,而不是比较==它在哪一行上崩溃?设置例外breakpoint@Paulw11我重新编辑了代码,很抱歉,我无法访问我的Xcode来检查我在问这个问题时编写的代码,现在应该都正确了。仍然与错误碰撞可能是@interface SKScene应该是@interface GameScene吗?@JaredH touchesbeent是一种更友好的处理用户触摸的方法。转换场景时,需要手动从视图中删除UIGestureRecognitors。