私は Xcode 7 beta 2 を使用しており、raywenderlich.com の Breakout チュートリアルに従って SpriteKit を学習しています。unarchiveFromFile を使用して GameScene を読み込もうとすると、次のエラーが表示されます。
GameScene.type には、unarchiveFromFile という名前のメンバーがありません。
コードは次のとおりです。
func didBeginContact(contact: SKPhysicsContact) {
// 1. Create local variables for two physics bodies
var firstBody: SKPhysicsBody
var secondBody: SKPhysicsBody
// 2. Assign the two physics bodies so that the one with the lower category is always stored in firstBody
if contact.bodyA.categoryBitMask < contact.bodyB.categoryBitMask {
firstBody = contact.bodyA
secondBody = contact.bodyB
} else {
firstBody = contact.bodyB
secondBody = contact.bodyA
}
// 3. react to the contact between ball and bottom
if firstBody.categoryBitMask == BallCategory && secondBody.categoryBitMask == BottomCategory {
//TODO: Replace the log statement with display of Game Over Scene
if let mainView = view {
let gameOverScene = GameOverScene.unarchiveFromFile("GameOverScene") as! GameOverScene
gameOverScene.gameWon = false
mainView.presentScene(gameOverScene)
}
}
}