This is a minimal app that crashes after selecting a .usdz file.
Error: Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1a7f15ba4) "Secure coding for state restoration requested after it was initialized without. NSApplicationDelegate was probably established too late."
import SwiftUI
import SceneKit
func sceneFromFile() -> SCNScene? {
var scene: SCNScene?
let panel = NSOpenPanel()
panel.allowsMultipleSelection = false
panel.canChooseDirectories = false
if panel.runModal() == .OK {
if let sceneURL = panel.url {
scene = try? SCNScene(url: sceneURL)
}
}
return scene
}
@main
struct SceneFromFileCrashApp: App {
let scene = sceneFromFile()
var body: some Scene {
WindowGroup {
SceneView(scene: scene)
}
}
}