【问题标题】:SpriteKit + xcode6 present scene crash appSpriteKit + xcode6 呈现场景崩溃应用
【发布时间】:2014-12-17 09:00:11
【问题描述】:

我正在创建一个简单的 MainMenu 场景并在“播放”按钮上选择我移动到游戏场景,如下所示:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {    
    for (UITouch *touch in touches) {
        CGPoint location = [touch locationInNode:self];
        SKNode *node = [self nodeAtPoint:location];

        if ([node.name isEqualToString:@"play"]) {

                SKScene *gameScene  = [[GameScene alloc] initWithSize:self.size];
                SKTransition *fadeTransition = [SKTransition fadeWithColor:[UIColor blackColor] duration:0.3];
                [self.view presentScene:gameScene transition:fadeTransition];


        }

    }
}

在转换应用程序崩溃后出现 EXC_BAD_ACCESS(代码=1)。我目前正在运行 Xcode6 + SpritKit/Objective-C

【问题讨论】:

    标签: objective-c ios8 sprite-kit


    【解决方案1】:

    发现问题——显然是由粒子targetNode分配引起的:

    starParticle.targetNode = self.scene;
    

    可能应该在呈现其他场景之前发布

    【讨论】:

      猜你喜欢
      • 2014-10-24
      • 1970-01-01
      • 1970-01-01
      • 2014-08-19
      • 2017-12-20
      • 1970-01-01
      • 1970-01-01
      • 2019-05-12
      • 1970-01-01
      相关资源
      最近更新 更多