PartiallyFrozenOJ PartiallyFrozenOJ - 6 months ago 37
Swift Question

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:

enter image description here

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 =
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

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: [:])