Open JanTG1 opened 1 year ago
Hi @JanTG1
Unfortunately, we were not able to reproduce the issue. Did you update from an older SDK version or is it a completely new integration? Could you please provide a sample to reproduce described behaviour?
I ma having the same problem while using it with UIViewControllerRepresentable.
struct MBNavigator: UIViewControllerRepresentable {
var response: RouteResponse
var options: NavigationRouteOptions
var manifestOptiVM: ManifestOptiViewModel
func makeUIViewController(context: Context) -> some UIViewController {
let navigationview = NavigatorController() //NavigationViewController(for: response, routeIndex: 0, routeOptions: options)
navigationview.maniVM = manifestOptiVM
return navigationview
}
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {
}
}
class NavigatorController: UIViewController {
var maniVM = ManifestOptiViewModel()
var viewController: NavigationViewController?
override func viewDidLoad() {
super.viewDidLoad()
self.setUpView()
}
private func setUpView() {
// Define two waypoints to travel between
let origin = Waypoint(coordinate: CLLocationCoordinate2D(latitude: 38.9131752, longitude: -77.0324047), name: "Mapbox")
let destination = Waypoint(coordinate: CLLocationCoordinate2D(latitude: 38.8977, longitude: -77.0365), name: "White House")
// Set options
let routeOptions = NavigationRouteOptions(waypoints: [origin, destination])
let navigationOptions = NavigationOptions(simulationMode: .always)
Directions.shared.calculate(routeOptions) {[weak self] session, result in
switch result {
case .failure(let error):
print(error.localizedDescription)
case .success(let response):
guard let self = self else { return }
// Pass the first generated route to the the NavigationViewController
viewController = NavigationViewController(for: response, routeIndex: 0, routeOptions: routeOptions, navigationOptions: navigationOptions)
viewController!.delegate = self
viewController!.modalPresentationStyle = .currentContext
self.present(viewController!, animated: true, completion: nil)
}
}
}
}
extension NavigatorController: NavigationViewControllerDelegate {
func navigationViewController(_ navigationViewController: NavigationViewController, didUpdate progress: RouteProgress, with location: CLLocation, rawLocation: CLLocation) {
self.maniVM.updateLocationData(progress: progress)
}
func navigationViewControllerDidDismiss(_ navigationViewController: NavigationViewController, byCanceling canceled: Bool) {
if (canceled) {
navigationViewController.dismiss(animated: true)
self.maniVM.dismissnavifation(dismiss: false)
}
}
}
@kried sorry for missing your reply! I have since updated the sdk. I am now using "MapboxNavigation', '~> 2.17.0'" and "MapboxMaps', '10.16.1'", but the issue still happens. I have tried debugging on my side but there is absolutely nothing that could be triggering this behaviour. Have you tried checking @osvaldoln's implementation? Would like to know if there is any progress on this.
Mapbox Navigation SDK version
2.17.0
Steps to reproduce
Start a step by step navigation which has alternative routes displayed on the mapview. The navigation will startstuttering / flashing the route. Checking the logs will show you that the reroutes get spammed each second.
Expected behavior
The Navigation Controller should do nothing when the user is not moving. No alternatives should be selected or removed.
Actual behavior
The Console spams this:
`[Info, nav-native]: RouteAlternativesControllerImpl::onStatus alternatives=[ ], removed=[ altId=309(routeId=HhZKQhlziKK239kZfzHh9azxoYxAL7zU5UZDwew0jV5awfLuAlvlEQ==_eu-west-1#1) ]
[Info, nav-native]: Requesting online route id 151: https://api.mapbox.com/directions/v5/mapbox/driving-traffic/LINK-REMOVED-FOR-SAFETY [Info, nav-native]: ParallelHybridRouter::getRoute: Timeout for task with id 141 triggered but request not found [Info, nav-native]: ParallelHybridRouter::getRoute: Refused to schedule onboard router request as pending request with id 149 has already finished [Info, nav-native]: RouteAlternativesControllerImpl::setRoutes isAlternativesChanged. alternatives=[ ], removed=[ ] [Info, navigation-ios/navigation]: Navigator alternative routes has been updated (0 alternatives set). [Info, nav-native]: OnlineRouter::getRoute req id 151 successfully returns [Info, nav-native]: Online response id 151 returned 146769 bytes [Info, nav-native]: RouteAlternativesControllerImpl::setRoutes isAlternativesChanged. alternatives=[ altId=311(routeId=HhZKQhlziKK239kZfzHh9azxoYxAL7zU5UZDwew0jV5awfLuAlvlEQ==_eu-west-1#1) ], removed=[ ] [Info, navigation-ios/navigation]: Navigator alternative routes has been updated (1 alternatives set). [Info, navigation-ios/navigation]: Navigator alternative routes has been updated (1 alternatives set). [Info, nav-native]: RouteAlternativesControllerImpl::onStatus alternatives=[ ], removed=[ altId=311(routeId=HhZKQhlziKK239kZfzHh9azxoYxAL7zU5UZDwew0jV5awfLuAlvlEQ==_eu-west-1#1) ] [Info, nav-native]: Requesting online route id 152: https://api.mapbox.com/directions/v5/mapbox/driving-traffic/LINK-REMOVED-FOR-SAFETY [Info, nav-native]: RouteAlternativesControllerImpl::setRoutes isAlternativesChanged. alternatives=[ ], removed=[ ] [Info, navigation-ios/navigation]: Navigator alternative routes has been updated (0 alternatives set). [Info, nav-native]: ParallelHybridRouter::getRoute: Timeout for task with id 142 triggered but request not found [Info, nav-native]: ParallelHybridRouter::getRoute: Refused to schedule onboard router request as pending request with id 150 has already finished [Info, nav-native]: OnlineRouter::getRoute req id 152 successfully returns [Info, nav-native]: Online response id 152 returned 146769 bytes [Info, nav-native]: RouteAlternativesControllerImpl::setRoutes isAlternativesChanged. alternatives=[ altId=313(routeId=HhZKQhlziKK239kZfzHh9azxoYxAL7zU5UZDwew0jV5awfLuAlvlEQ==_eu-west-1#1) ], removed=[ ]`
This just keeps going about once each second, even if the user does nothing, does not touch the screen or move in any way. The Route Layer begins flashing and the map stutters on each reload. I have noticed that it stops once the user manually selects one of the route alternatives. The navigation controller then stops automatically switching alternative.
Is this a one-time issue or a repeatable issue?
repeatable