Save SCNScene Edits

I need help in trying to understand why my iOS 12.1 app is not saving runtime edits to SCNMaterials and SCNLights. Here's the setup:


After creating assets in Blender 2.79b, I exported the .dae file to a .scnassets folder and copied that folder into the app. Then I converted the .dae file to .scn via Xcode 10.1. All of the assests appear correctly when the app is run. However, any SCNLights added to the SCNScene or changes to a SCNMaterial's color are not saved.


SCNScene's write(to: options: delegate:) returns true and the delegate reports Error: nil. I've tried adding SCNSceneSource.LoadingOption.strictConformance.rawValue : true as an option. But doing so has no effect. The string for the URL used in write(to: options: delegate:) is persisted in an instance of a Core Data entity.


Any help would be greatly appreciated.

With the hope it might help someone else, I'll post the solution that worked in the context of my app: I forgot to delete the file containing the SCNScene before calling write(to: options: delete). After first deleting the file, everything worked normally.

Save SCNScene Edits
 
 
Q