从Xcode 6 Beta 6升级到Xcode 6.0.1后编译错误

时间:2014-09-23 06:06:59

标签: ios xcode swift

自从我从Xcode 6 Beta 6升级到Xcode 6.0.1后,我遇到了一个问题。

使用Xcode 6.0.1,我有62个错误,但没有测试版。

示例:

    balloonro.physicsBody = SKPhysicsBody (circleOfRadius: balloonro.size.width/2)
    balloonro.physicsBody.dynamic = true
    balloonro.physicsBody.categoryBitMask = balloonCategory | pinkCategory
    balloonro.physicsBody.contactTestBitMask = flechetteCategory
    balloonro.physicsBody.collisionBitMask = balloonCategory
    balloonro.physicsBody.mass = 1
    balloonro.physicsBody.restitution = 1
    balloonro.physicsBody.allowsRotation = true

在所有行上,Xcode 6.0.1说:

  

“SKPhysicsBody?没有名为'restitution / mass / dynamic / etc'的成员

我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:1)

SKPhysicsBody?是可选值。你必须打开它或使用可选的链接。例如,

balloonro.physicsBody?.dynamic = true