exploit ARKit's face tracking feature to build .obj face model files. It generally follows practices in Tracking and visualizing faces. The app gets the anchor in func renderer( renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor), and update the geometry in func renderer( renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor).
For the face model export, the following function is used, which wraps the ARSCNFaceGeometry in a MDLAsset and export the asset. The code is as follows.
The application works fine before on iOS 13. However, when I installed it on iOS 14, the app crashes on the line try asset.export. The do-catch syntax did not catch the error, it directly crashes with EXCBADACCESS. I tried to export only a SCNBox in this step and it worked fine, seems it has something to do with the ARSCNFaceGeometry.
My Mac and the test device are all updated to the newest system, the test device is an iPhone X.
For the face model export, the following function is used, which wraps the ARSCNFaceGeometry in a MDLAsset and export the asset. The code is as follows.
Code Block func exportMesh(_ geometry: SCNGeometry, to url: URL, completion: (() -> ())?) { DispatchQueue.global().async { let mesh = MDLMesh(scnGeometry: geometry) let asset = MDLAsset() asset.add(mesh) do { try asset.export(to: url) } catch { print("Can't write mesh to url") } DispatchQueue.main.async { completion?() } } } l
The application works fine before on iOS 13. However, when I installed it on iOS 14, the app crashes on the line try asset.export. The do-catch syntax did not catch the error, it directly crashes with EXCBADACCESS. I tried to export only a SCNBox in this step and it worked fine, seems it has something to do with the ARSCNFaceGeometry.
My Mac and the test device are all updated to the newest system, the test device is an iPhone X.