-
Notifications
You must be signed in to change notification settings - Fork 315
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
[Bug]: Crash on re-routing due to Access Token not set in Directions.Shared (Dynamic Access Token) #4681
Comments
Hello @emilianoalvarez91. Thank you for your request. I just want to clarify, how do you start Active Navigation? |
Hi @chizhavko, sure! How I instantiate the MapboxNavigationProvider: private let navigationProvider: MapboxNavigationProvider
init() {
let config = CoreConfig(
credentials: .init(accessToken: "{{Access_token}}")
)
self.navigationProvider = MapboxNavigationProvider(coreConfig: config)
} Once I get the routes I do: private func startNavigation() {
navigationProvider.mapboxNavigation.tripSession().startActiveGuidance(with: navigationRoutes, startLegIndex: 0)
cameraState = .following
} I thought in the beginning that it could be an issue with custom navigation as I wasn't using the NavigationViewController, so then I rebuild everything using the navigationController and start the navigation by doing: let navigationOptions = NavigationOptions(
mapboxNavigation: navigationProvider.mapboxNavigation,
voiceController: navigationProvider.routeVoiceController,
eventsManager: navigationProvider.eventsManager(),
styles: [DayStyle()],
predictiveCacheManager: navigationProvider.predictiveCacheManager,
navigationMapView: navigationMapView
)
let navigationViewController = NavigationViewController(
navigationRoutes: navigationRoutes,
navigationOptions: navigationOptions
) In both cases, the same issue occurs. Active navigation starts correctly, but once a rerouting occurs the SDK crashes. I tried finding a way to set the access token to the Directions' singleton, but there isn't a way. |
Hello @emilianoalvarez91 |
It can be reproduced with the CoreSDKExample Steps to reproduce:
App crashes Herewith is a video, showcasing it: |
@emilianoalvarez91 Thank you for your ticket. After investigation we found that this issue already resolved on our side and we planing to release fix in next release. |
Hello @emilianoalvarez91 |
I cannot test the new version 3.2.0 in a physical device as I'm not using SPM in the project. When I'm trying to fetch version 3.2.0 I've noticed that you are not exposing MapboxDirections, MapboxNavigationCore, MapboxNavigationUIKit and _MapboxNavigationHelpers as binaries, so I'm not able to upgrade and test. |
The issue about the SDK distribution is discussed in #4703 |
Mapbox Navigation SDK version
v3.1.1
Steps to reproduce
MapboxNavigationProvider(coreConfig: .init(credentials: .init(accesstoken: "{{Access_token}}")))
navigationProvider.mapboxNavigation.routingProvider().calculateRoutes(options: routeOptions).value
Expected behavior
Rerouting happens and new route is generated.
Actual behavior
App crashes due to Swift runtime failure: precondition failure caused by
MapboxDirections.Directions.shared.credentials not being set
I've tried setting MapboxOptions.accessToken = "{{Access_token}}" and it also doesn't work, but works correctly on Android Nav SDK. This issue is causing a problem because we don't want to expose the api token in the info.plist but have rotating tokens.
Is this a one-time issue or a repeatable issue?
repeatable
The text was updated successfully, but these errors were encountered: