Potential Memory Leak
First of all, thank you for sharing this framework!
I've been getting errors when the app goes into background:
Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background) (IOAF code 6)
I suspect the RecordAR is never been dealloc, maybe because RecordAR holds a strong reference to ARSceneKit which might potentially create a retain cycle in certain cases?
Thank you
Will investigate the issue and get back to you soon.
Thank you!
To give you a little more context, in my case I have a button that can switch between AR camera and normal camera. So if you choose to programmatically initialize and add ARSCNView to the view hierarchy based on certain action. You'll have UIViewController holding a strong reference to ARSCNView, UIViewController holding a strong reference to RecordAR and RecordAR holding a strong reference to ARSCNView. And I saw in your source code RecordAR also holds a strong reference to ARSCNView's parent view controller which might cause a retain cycle (Didn't look too deep into the source code, I think this is the case).
facing the same issue. RecordAR holding strong reference to the ARSCNView.
@mssjappjwt did you find any workaround for this like passing unowned or weak ARSCNView ?
how to fix
Facing same issue, app crashing..
Facing same issue, app crashing..
Taking a global strong reference to view object is a bad idea:
import Foundation
import ARKit
private var view: Any? // this must be instance & weak variable!
private var renderEngine: SCNRenderer! // instance variable too
@available(iOS 11.0, *)
struct RenderAR {
var ARcontentMode: ARFrameMode!
.....
https://github.com/AFathi/ARVideoKit/blob/c51fc0db850b8106babba2bd9105974b348b0c3e/ARVideoKit/Rendering/RenderAR.swift#L12
... and other classes.
@dneprDroid
Feel free to submit a pull request with the fixes.
I have checked it, and with these changes component is deallocated. https://github.com/AFathi/ARVideoKit/pull/82