SKNode addChild crash when targeting iOS 9 but not iOS 8

I'm getting a crash in SpriteKit that occurs when I target iOS 9.0 but doesn't occur when I target iOS 8.0. The code looks something like this:


class MYGameScene: SKScene {
  var canvas: SKNode!
  var character: MYCharacter!

  override func didMoveToView(view: SKView) {
    super.didMoveToView(view)

    canvas = SKSpriteNode()
    self.addChild(canvas)


    character = MYCharacter()
    canvas.addChild(worm) // crash!

    [...]
  }
}


#0 0x0000000188099498 in b2Fixture::Create(b2Body*, b2FixtureDef const*) ()

#1 0x0000000188096c84 in b2Body::CreateFixture(b2FixtureDef const*) ()

#2 0x0000000188083ed0 in __26-[PKPhysicsWorld addBody:]_block_invoke ()

#3 0x00000001880861c0 in -[PKPhysicsWorld(Private) _runBlockOutsideOfTimeStep:] ()

#4 0x0000000188083d80 in -[PKPhysicsWorld addBody:] ()

#5 0x0000000190d575d0 in __30-[SKNode insertChild:atIndex:]_block_invoke ()

#6 0x0000000190d59610 in -[SKNode _processSearchTokens:visited:usingBlock:stopPointer:] ()

#7 0x0000000190d58df4 in -[SKNode _processSearchTokens:visited:usingBlock:stopPointer:] ()

#8 0x0000000190d58d3c in -[SKNode _processSearchTokens:visited:usingBlock:stopPointer:] ()

#9 0x0000000190d58b48 in -[SKNode _enumerateChildNodesWithName:usingBlock:stopPointer:] ()

#10 0x0000000190d58554 in -[SKNode enumerateChildNodesWithName:usingBlock:] ()

#11 0x0000000190d5744c in -[SKNode insertChild:atIndex:] ()

#12 0x0000000190d57090 in -[SKNode addChild:] ()

#14 0x00000001000c66b4 in MYGameScene.didMoveToView(SKView) -> () at /MYApp/MYGameScene.swift:246

Any ideas? This appears to be a bug in SpriteKit?

I get a very similar error. Did you find a solution? /Olof

Unless you didn't paste in all your declared variables, worm comes out of nowhere. I'm referring to this line....


canvas.addChild(worm) // crash!
SKNode addChild crash when targeting iOS 9 but not iOS 8
 
 
Q