我正在使用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 …Run Code Online (Sandbox Code Playgroud)