iOS-Estimote-UWB-SDK icon indicating copy to clipboard operation
iOS-Estimote-UWB-SDK copied to clipboard

EstimoteUWBManager has a retain cycle

Open Emerson-Shatouhy opened this issue 1 year ago • 0 comments

We're testing using EstimoteUWBManager in the demo app. We're finding that any delegate we pass to it (which we hold weakly) is being retained indefinitely. Specifically, it seems EstimoteUWBManager can never be released because it creates its own retain cycle.

Is there anything we can do to release it? We tried calling stopListening(), but it still sticks around.

Screenshot 2024-05-21 at 1 27 22 PM Screenshot 2024-05-21 at 1 30 52 PM
func reset() {
    uwbManager?.stopScanning()
    let newDelegate = EstimoteMgrDelegate()
    self.uwbDelegate = newDelegate
    newDelegate.app = self
    uwbManager = EstimoteUWBManager(delegate: newDelegate,
                                    options: EstimoteUWBOptions(shouldHandleConnectivity: false,
                                                                isCameraAssisted: false))
    uwbManager?.startScanning()
}

private func setupUWB() {
    let newDelegate = EstimoteMgrDelegate()
    self.uwbDelegate = newDelegate
    newDelegate.app = self
    
    uwbManager = EstimoteUWBManager(delegate: newDelegate,
                                    options: EstimoteUWBOptions(shouldHandleConnectivity: false,
                                                                isCameraAssisted: false))
    uwbManager?.startScanning()
    
    // Make Beacons for testing
    let Carmel:Beacon = Beacon(deviceId: "b0d51b8146daa33b5ddac07e2e808819", positionInLine: 0, distance: 0.0, connected: false)
    let Lemon:Beacon = Beacon(deviceId: "abf6d8ba23fd7db317c2ac3e7e2af434", positionInLine: 1, distance: 0.0, connected: false)
    let Marshmellow:Beacon = Beacon(deviceId: "3dfc1b3b1d3f88ffae4be2c70002d13b", positionInLine: 2, distance: 0.0, connected: false)
    beacons["b0d51b8146daa33b5ddac07e2e808819"] = Carmel
    beacons["abf6d8ba23fd7db317c2ac3e7e2af434"] = Lemon
    beacons["3dfc1b3b1d3f88ffae4be2c70002d13b"] = Marshmellow
}

Emerson-Shatouhy avatar May 21 '24 17:05 Emerson-Shatouhy