【问题标题】:Strange SceneKit Linker Error in Xcode 8 Beta 6Xcode 8 Beta 6 中出现奇怪的 SceneKit 链接器错误
【发布时间】:2017-01-02 16:14:00
【问题描述】:

我最近更新到最新的 Xcode 8 beta 6。我之前是 beta 4(我想)。我试图编译我的代码并得到这个错误:

这里是sn-p:

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)
}

如果我注释掉分配物理体的两行,然后设置其类别,则代码编译时错误为零。我不太清楚错误试图暗示什么。非常感谢任何建议。

【问题讨论】:

    标签: swift xcode macos scenekit macos-sierra


    【解决方案1】:

    这是编译器中的一个已知问题。 作为一种解决方法,您可以使用[:] 而不是nil

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

    【讨论】:

    • 如果你见面,我欠你啤酒!那解决了它!我一直到美国东部标准时间凌晨 1:30 才试图找到源头。
    • 你能详细说明这个错误是什么吗?它只是在 8-beta-6 中吗?在其他情况下会发生吗?
    • 您可以在这里了解更多信息:github.com/apple/swift/pull/4299
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多