Have the same problem. App can build and app can run, but warning is always there
Post
Replies
Boosts
Views
Activity
I have the same question. I am using Japanese fonts that should render differently in vertical and horizontal format. It's not just a minor or cosmetic issue: the charaters are different. What's the alternative?
Hi @morphing,
have you found an elegant way to do this? I can use a document picker to open the .obj file but MDLAsset(url:) cannot find the corresponding .mtl and .jpg files. These files are definitely there, with the right names and in the right locations.
Maybe I am using AccessingSecurityScopedResource in the wrong way ?
Thanks for any pointers
Having the same problem while trying to draw with the pen in PencilKit, and using fingers to manipulate a 3D shape in SceneKit. Any suggestions?
Solved by removing the let scene = sceneFromFile() initializer.
Instead I added a button to explicitly load the file after an initial layout was done. I don't know how to do it without the button since an .onAppear { scene = sceneFromFile() } or .task { scene = sceneFromFile() } respectively crash or don't do anything.
Still feels like a bug.
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 {
@State var scene: SCNScene?
var body: some Scene {
WindowGroup {
VStack {
Button("Open") {
scene = sceneFromFile()
}
SceneView(scene: scene)
}
}
}
}
The crash disappears when the App Sandbox entitlement is set to NO.
But then a new log entry appears:
flock failed to lock list file (/var/folders/bg/t20_gl712tj3g9tx5yn730740000gn/C//Magenta.KanaConsole.SceneFromFileCrash/com.apple.metal/16777235_530/functions.list): errno = 35
crash report attached
Translated Report.txt
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)
}
}
}
Hi,
I have a similar problem. App crashes with the same error as in OP, and window with selected image does not show (In my case I load a SCNScene from a user-selected .usdz file.)
Is there a resolution?
thx
I haven't been able to find a way to do this either. Googling doesn't help...