ARKit_ Snapshot()_ It crashes the app

Hello everyone!


I am pretty new in this programming world but I have a problem that keeps me from improve my apps: Whenever I include the snapshot() function to my AR app, once I touch the button that triggers that function, the whole app crashes and it tells me something like this:

"

2019-12-13 11:56:09.651892+0100 003_ARApp[3851:1055500] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_03_ARApp.ViewController save:]: unrecognized selector sent to instance 0x12de094f0'

*** First throw call stack:

(0x1b354980c 0x1b3271fa4 0x1b344d36c 0x1b75e06e8 0x1b354dc88 0x1b354fa6c 0x1b75b3ab0 0x1b6feb8ac 0x1b6febc10 0x1b6feac2c 0x1b75ed288 0x1b75ee5c8 0x1b75cab78 0x1b7642ef8 0x1b7645454 0x1b763e2c8 0x1b34c77c4 0x1b34c771c 0x1b34c6eb4 0x1b34c2000 0x1b34c18a0 0x1bd419328 0x1b75b2740 0x102804d00 0x1b334c360)

libc++abi.dylib: terminating with uncaught exception of type NSException

(lldb)

"


I tried the code in an empty preset of AR provided by XCode to avoid other errors in code, and I only have one outlet Button action like this:


@IBActionfunc didTakeSnapshot(_ sender: UIButton) {
        UIImageWriteToSavedPhotosAlbum(self.sceneView.snapshot(), nil, nil, nil)
    }


Any idea of what is happening?? I am running out of options, since the info provided by apple doesn`t seem to work for me.


Thank you all! I would really appreciate your comments!