Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EstimoteUWBManager has a retain cycle #3

Open
Emerson-Shatouhy opened this issue May 21, 2024 · 0 comments
Open

EstimoteUWBManager has a retain cycle #3

Emerson-Shatouhy opened this issue May 21, 2024 · 0 comments

Comments

@Emerson-Shatouhy
Copy link

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant