Search code examples
iosswiftscenekitexc-bad-access

Debug (MetalScen) SceneKit EXC_BAD_ACCESS


Hi I'm trying to put together a panorama view that react to motion and touch using MetalScen, you can change the the panorama image by selection from a collection view.

the problem is sometimes the app crash randomly when I choose new image, it happens randomly but I noticed it happens more often if I switch between images to quick. the crash that I get is

SceneKit`C3DModelValueStoragePrepareNextFrame: EXC_BAD_ACCESS

see image 👉 thread crash

Here is the project on GitHub (needs a pod install), any help or clues are appreciated

thanks


Solution

  • after long battle and fight with the code and search through the web, this for any person has the same problem

    I found that :

    The panorama View (SCNScene) where I'm changing the image rapidly. was on a strong reference and that for some reason ( I don't know , please inform me ) caused the EXC_BAD_ACCESS crash, I changed it to weak reference in the declaration, and it's pretty smooth and no crashes