简体   繁体   中英

Strange SceneKit Linker Error in Xcode 8 Beta 6

I recently updated to the latest Xcode 8 beta 6. I was previously on beta 4 (I think). I attempted to compile my code and got this error:

在此处输入图片说明

Here is the snippet:

private func setupPlane() {

    // create plane geometry with size and material properties
    let myPlane = SCNPlane(width: 10000.0, height: 10000.0)
    myPlane.firstMaterial!.diffuse.contents = NSColor.orange.cgColor
    myPlane.firstMaterial!.specular.contents = NSColor.white.cgColor

    // intialize noe
    let planeNode = SCNNode()
    // assign plane geometry to the node
    planeNode.geometry = myPlane

    // rotate -90.0 about the x-axis
    let rotMat = SCNMatrix4MakeRotation(-CGFloat(M_PI/3.0), 1.0, 0.0, 0.0)
    planeNode.transform = rotMat
    planeNode.position = SCNVector3Make(0.0, 0.0, 0.0)

    // setup the node's physics body property
    planeNode.physicsBody = SCNPhysicsBody(type: .static, shape: SCNPhysicsShape(geometry: myPlane, options: nil))
    planeNode.physicsBody!.categoryBitMask = PhysicsMask3DOF.plane.rawValue

    // add to scene
    sceneView.scene!.rootNode.addChildNode(planeNode)
}

If I comment out the two lines where the physics body is assigned and then its category is set, the code compiles with zero errors. I am not really clear what the error is trying to hint at. Any suggests are much appreciated.

that's a known issue in the compiler. As a workaround you can use [:] instead of nil :

SCNPhysicsShape(geometry: myPlane, options: [:])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM