Tracking and Visualizing Faces demo crashes

I tried running the Tracking and Visualizing Faces demo and unfortunately, it crashes at let url = Bundle.main.url(forResource: resourceName, withExtension: "scn", subdirectory: "Models.scnassets")!

The "Models.scnassets" is available in the project.

Replies

This problem occurred when I upgraded my system to the latest version.

I tested it. Now the code has changed the path to remove the (subdirectory: "Models.scnassets") parameter, and if it doesn't work, add the files you want to the Resource folder in the Bundle.main path

let fileUrl = Bundle.main.url(forResource: resourceName, withExtension: "scn")!

Now the file can be recognized normally. However, my code here has encountered a little problem, which is still being solved now. There are problems in upgrading the system and these paths

let faceScene = SCNScene(named: "face.scn", inDirectory: "Models.scnassets/face")

It's still not readable, but if you change it to obj you can recognize it

let faceScene = SCNScene(named: "face.obj", inDirectory: "Assets.scnassets/face")

The code written before can recognize the path normally, now upgrade to ios16.2 will not work, where there is no setting or system problems, not clear.