mapbox / mapbox/mapbox-navigation-ios
NavigationView not clearing resources on exit when it is a sub-controller
@S2Ler is already working on this.
Since Jun 24, 2021.
- Dominant language
- Swift
- Stars
- 918
- Forks
- 326
- Avg merge
- 1h 16m
- Merged PRs (30d)
- 3
Description
Mapbox Navigation SDK version:
v2.0b9
I scanned the commit history from b9 to b11 and I don't see any resource commits, so it is probable that b11 has the same issue, the only reason I couldn't move to b11 is because a lot of stuff changed in the base .mapview is now missing some properties and basically created about 50 new errors in my projects of customization's.
Steps to reproduce
- Create a view, embed the NavigationViewController as a sub-controller / subview:
navigationViewController.willMove(toParent: parentController);
navigationViewController.view.frame = self.bounds
self.addSubview(navigationViewController.view)
parentController.addChild(navigationViewController)
navigationViewController.didMove(toParent: parentController)
- On stopping it:
navigationViewController.willMove(toParent: nil)
navigationViewController.view.removeFromSuperview();
navigationViewController.removeFromParent()
navigationViewController.didMove(toParent: nil)
navigationViewController = nil
Also tried adding before the willMove
navigationViewController.navigationService.endNavigation(feedback: nil);
Please note, it does appear to clear resources properly if you do using this as
present and dismiss as a fullscreen popup.
Expected behavior
It to clear location services, and stop all routing...
Actual behavior
You can still see the location updates in the console, and if you move the device around the routing voice will chime in every so often. In addition each time you open the navmap again, the device gets a lot slower, after about 3 or 6 opens, the app is un-usable...
Additional Notes:
- As I have tested more I have seen the bad behavior twice when using present/dismiss (rather than embedding), so maybe the resources aren't being cleaned others cases. (Just shows up more frequently while embedded) However, one thing I just noticed in this case is when it failed this time is that my internet was really slow, and the two times I viewed the map in a row the voice didn't speak the original instructions until a while after I had closed the map. Then during other app usage it finally triggered the voice.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.