내 게임에 10 카운트 루프를 추가하려고하는데 코드를 실행하면 "variable not assignable missing__block"오류 메시지가 생성됩니다. 아무도 내가 잘못 가고 올바른 방향으로 나를 가리 키도록 말할 수 있습니까?변수를 할당 할 수 없음 missing__block
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint currentLocation = [[touches anyObject] locationInNode:self];
CGPoint previousLocation = [[touches anyObject] previousLocationInNode:self];
CGRect shipRect = _ship.frame;
if (CGRectContainsPoint(shipRect, previousLocation))
{
[self launch:10 p1:currentLocation p2:previousLocation rect1:shipRect];
}
}
-(void)launch:(int)count p1:(CGPoint) currentLocation p2:(CGPoint) previousLocation rect1:(CGRect) shipRect
{
CGPoint lvPosition = CGPointMake(_ship.position.x - (previousLocation.x - currentLocation.x), _ship.position.y);
_ship.position = lvPosition;
SKAction *sound = [SKAction playSoundFileNamed:@"slideup.mp3" waitForCompletion:NO];
SKAction *moveNode = [SKAction moveByX:lvPosition.x y:10.0 duration:3.0];
[_ship runAction: sound];
[_ship runAction: moveNode completion:^{[self launch:count-- p1:currentLocation p2:previousLocation rect1:shipRect];}]; /*variable not assignable missing__block error*/
}
매개 변수를 변경하는 것은 바람직하지 않습니다. 블록에서 또는하지 말아야합니다. – sage444
루프를 추가하려고하는데 코드 샘플에 루프가 없습니다. 실수로 표본에서 뭔가를 놓친 적이 있습니까? – CRD