-
Notifications
You must be signed in to change notification settings - Fork 326
Upgrading from v1.x to v2.0.x
Mapbox Navigation SDK for iOS v2.0.0 is a major new version of the SDK. To upgrade, follow the installation instructions. Note that the MapboxNavigation framework’s Carthage support has been discontinued in favor of Swift Package Manager.
If you decide to keep using Carthage, you will need to migrate from framework bundles to XCFrameworks.
Starting with version v2.0.0, the Mapbox Navigation SDK is licensed under the Mapbox Terms of Service, a proprietary license. It is no longer available under the permissive ISC License.
Version 2.0.0 includes numerous important changes to the public APIs of the MapboxNavigation and MapboxCoreNavigation frameworks as well as their dependencies. There are several backwards-incompatible changes to be aware of as you upgrade, which are discussed below and divided by framework so that you can upgrade different portions of your application at different times.
-
MBXNavigationBillingMethodis no longer supported. (#3147) - New per trip pricing option. For more information, see the “Pricing” guide (#3147)
- Supported dependency managers:
- Swift Package Manager (new)
- CocoaPods
- Carthage (MapboxCoreNavigation only; MapboxNavigation no longer supported)
- Minimum Xcode version required to build the SDK: 12.4 (11.x no longer supported)
- Minimum iOS deployment target: 11.0 (10.x no longer supported)
Turf v2 revamps the GeoJSON types to better conform to the GeoJSON specification. Please consult the Turf v2.0.0 release notes, which details changes to the type system and examples for upgrading.
GeoJSON is now represented using Turf types throughout Mapbox’s SDKs, including in the map SDK’s public API, so it is no longer necessary to convert between Turf GeoJSON types and the map SDK’s shape types.
- The preferred way to set your Mapbox access token is to set the
MBXAccessTokenkey in your application’s Info.plist.MGLMapboxAccessTokenis still supported as a deprecated fallback. - The
Incident.impactproperty is now anIncident.Impactvalue instead of a string.
- The preferred way to set your Mapbox access token is to set the
MBXAccessTokenkey in your application’s Info.plist.MGLMapboxAccessTokenis still supported as a deprecated fallback.
Mapbox Maps SDK v10 introduces 3D terrain, improves performance, and upgrades from OpenGL to Metal. Please consult the v10 migration guide, which details many changes that likely affect your application’s user interface code.
Other changes:
- The preferred way to set your Mapbox access token is to set the
MBXAccessTokenkey in your application’s Info.plist.MGLMapboxAccessTokenis no longer supported.
- MapboxCoreNavigation no longer depends on MapboxAccounts.
- MapboxNavigation now depends on MapboxMaps instead of Mapbox.framework (Mapbox-iOS-SDK pod).
Symbols renamed or replaced:
- Removed obsoleted
NavigationMapView.navigationMapDelegate, which was replaced byNavigationMapView.delegate. - Renamed
NavigationMapView.navigationMapViewDelegatetoNavigationMapView.delegate. - Renamed
NavigationMapViewController.mapViewtoNavigationMapViewController.navigationMapView. - Removed
NavigationAnnotation. -
NavigationMapView.updateCourseTracking(location:camera:animated:)accepts aCameraOptionsas an argument instead of anMGLMapCamera. - Removed
NavigationMapView.showsUserLocation, becauseNavigationMapViewno longer inherits fromMGLMapView.NavigationMapView.mapViewis now exposed as public property instead. - Changed the type of
NavigationViewController.pendingCamerafromMGLMapCameratoCameraOptions. - Renamed the
Constants.MBRouteLineWidthByZoomLevelvariable toConstants.MBRouteLineWidthByZoomLevel, which now acceptsDoublefor keys and values. - Renamed the
MBCurrentLegAttributeproperty toCurrentLegAttribute. - Renamed the
MBCongestionAttributeproperty toCongestionAttribute. - Renamed
NavigationViewController.mapViewtoNavigationViewController.navigationMapView. - Renamed
NavigationMapView.highlightBuildings(at:in3D:)toNavigationMapView.highlightBuildings(at:in3D:completion:). - Renamed the
NavigationMapView.updateRoute(_:)method toNavigationMapView.travelAlongRouteLine(to:). - Renamed the following waypoint styling delegate methods:
-
NavigationMapViewDelegate.navigationMapView(_:waypointCircleLayerWithIdentifier:source:)toNavigationMapViewDelegate.navigationMapView(_:waypointCircleLayerWithIdentifier:sourceIdentifier:) -
NavigationMapViewDelegate.navigationMapView(_:waypointSymbolLayerWithIdentifier:source:)toNavigationMapViewDelegate.navigationMapView(_:waypointSymbolLayerWithIdentifier:sourceIdentifier:) -
NavigationViewControllerDelegate.navigationViewController(_:waypointCircleLayerWithIdentifier:source:)toNavigationViewControllerDelegate.navigationViewController(_:waypointCircleLayerWithIdentifier:sourceIdentifier:) -
NavigationViewControllerDelegate.navigationViewController(_:waypointSymbolLayerWithIdentifier:source:)toNavigationViewControllerDelegate.navigationViewController(_:waypointSymbolLayerWithIdentifier:sourceIdentifier:)
-
Symbols renamed or replaced:
- Renamed
PassiveLocationManagertoPassiveLocationProviderandPassiveLocationDataSourcetoPassiveLocationManagerfor consistency withNavigationLocationProviderandNavigationLocationManager. -
PassiveLocationProvidernow conforms toLocationProviderprotocol instead ofMGLLocationManager. - Changed the type of the
PassiveLocationProvider.delegateproperty fromMGLLocationManagerDelegatetoLocationProviderDelegate. - Replaced the
PassiveLocationProvider.accuracyAuthorization()method with thePassiveLocationProvider.accuracyAuthorizationproperty, which now returnsCLAccuracyAuthorizationinstead ofMBNavigationAccuracyAuthorization. - Renamed
PassiveLocationManager.startUpdatingLocation(completionHandler:)toPassiveLocationManager.startUpdatingLocation(). This method now runs synchronously likeCLLocationManager.startUpdatingLocation(). - Renamed
RouterDataSource.locationProviderandActiveNavigationEventsManagerDataSource.locationProviderproperties toRouterDataSource.locationManagerTypeandActiveNavigationEventsManagerDataSource.locationManagerTyperespectively.
Symbols renamed or replaced:
- Removed the deprecated
CarPlayNavigationDelegate.carPlayNavigationViewControllerDidArrive(_:)method. - Renamed
CarPlayManager.mapViewtoCarPlayManager.navigationMapView. - Removed the deprecated
CarPlayManager.overviewButtonproperty. - Removed the unused
CarPlayNavigationViewController.drivingSideproperty. - Renamed
CarPlayNavigationDelegatetoCarPlayNavigationViewControllerDelegateandCarPlayNavigationViewController.carPlayNavigationDelegatetoCarPlayNavigationViewController.delegate. - Moved
CarPlaySearchController.searchTemplate(_:updatedSearchText:completionHandler:),CarPlaySearchController.searchTemplate(_:searchTemplate:selectedResult:completionHandler:)methods toCarPlaySearchControllerDelegateprotocol; RenamedresultsOrNoResults(_:limit:)tosearchResults(with:limit:). - Moved
GeocodedPlacemarkextension fromCarPlaySearchControllerto the application level. RemovedGeocodedPlacemark.listItem(). -
CarPlayManagerDelegate.carplayManagerShouldDisableIdleTimer(_:)was renamed toCarPlayManagerDelegate.carPlayManagerShouldDisableIdleTimer(_:).
Symbols renamed or replaced:
- Removed the deprecated
InstructionsBannerViewDelegate.didDragInstructionsBanner(_:)method. - Removed the unused
NavigationViewController.originproperty. -
NavigationViewController.indexedRoute,NavigationService.indexedRouteandRouter.indexedRouteproperties are readonly now. Use dedicatedRouter.updateRoute(with:routeOptions:)method to update the route. - Removed the
NavigationViewController.indexedRoute,NavigationService.indexedRoute,Router.indexedRouteproperties in favor ofNavigationViewController.indexedRouteResponse,NavigationService.indexedRouteResponse, andRouter.indexedRouteResponse. Removed theRouteProgress.indexedRouteproperty. AddedNavigationViewController.prepareViewLoading(routeResponse:, routeIndex:, routeOptions:, navigationOptions:)method to setup it forUIStoryboard. - Renamed
RouteOptions.without(waypoint:)toRouteOptions.without(_:). - Renamed
FeedbackTypetoActiveNavigationFeedbackTypeandEventsManagerDataSourcetoActiveNavigationEventsManagerDataSource.
Tiles cache cleanup:
When migrating please ensure you have cleaned up old navigation tiles cache folder to reclaim disk space.
- Navigation SDK 2.0 caches navigation tiles in a default folder under
<APP_FOLDER>/Library/Caches/<APP_BUNDLE_ID>/tiles. - Previous versions of Nav SDK used to cache tiles under a default folder
<APP_FOLDER>/Library/Caches/<APP_BUNDLE_ID>/.mapbox. - Old cache is not compatible with a new version of SDK 2.0.
- It makes sense to delete any folders used previously for caching including a default one.
-
NavigationSettings.shared.tileStoreConfigurationenables you to specify a path where nav and map tiles will be saved and if a custom directory was used, it should be cleared as well. - Be sure to configure the custom path before starting a free drive or an active guidance session if you don't want the defaults.
-
If you have any questions, please contact Mapbox’s support team.
Switching from discrete framework bundles to XCFrameworks requires a few changes to your project. Follow these migration steps to switch:
- Delete your
Carthagefolder to remove any existing framework bundles. - Build new XCFrameworks by running
carthage bootstrap --platform iOS --use-xcframeworks --use-netrc. - Remove references to the old frameworks in each of your targets:
- Delete references to Carthage frameworks from the target's Frameworks, Libraries, and Embedded Content section and/or its Link Binary with Libraries build phase.
- Delete references to Carthage frameworks from any Copy Files build phases.
- Delete the target's
carthage copy-frameworksbuild phase, if present.
- Add references to XCFrameworks in each of your targets:
- For an application target: In the General settings tab, in the Frameworks, Libraries, and Embedded Content section, drag and drop each XCFramework you use from the [Carthage/Build][] folder on disk.
- For a framework target: In the Build Phases tab, in a Link Binary with Libraries phase, drag and drop each XCFramework you use from the [Carthage/Build][] folder on disk.