SceneKit Cocoa snapshot failed assertion SceneKit Cocoa snapshot failed assertion xcode xcode

SceneKit Cocoa snapshot failed assertion


It works on Metal.

In macOS use Tab View (for example) for accommodation of SceneView and NSImageView.

I used Xcode 11.4 on macOS 10.15.4 Catalina.

import SceneKitimport Cocoaclass ViewController: NSViewController {        @IBOutlet var sceneView: SCNView!    @IBOutlet var imageView: NSImageView!        override func viewDidLoad() {        super.viewDidLoad()                sceneView.scene = SCNScene()                sceneView.pointOfView?.position.z = 20        sceneView.allowsCameraControl = true        sceneView.showsStatistics = true        sceneView.backgroundColor = NSColor.black        sceneView.autoenablesDefaultLighting = true        let box = SCNBox(width: 1.0,                        height: 1.0,                        length: 1.0,                 chamferRadius: 0.0)                box.firstMaterial?.diffuse.contents = NSColor.systemTeal        let boxNode = SCNNode(geometry: box)        boxNode.position = SCNVector3(0,0,-10)        sceneView.scene!.rootNode.addChildNode(boxNode)    }        @IBAction func createSnapshot(_ sender: NSButton) {        let image = sceneView.snapshot()        imageView.image = image    }}

enter image description here