Skip to content

Commit ec6e1e9

Browse files
committed
Update
1 parent f8f1932 commit ec6e1e9

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Changes to the Mapbox Navigation SDK for iOS
22

3+
## v2.18.2
4+
5+
### CarPlay
6+
7+
* Fixed CarPlay crash when calling `CarPlayManager.routePreview()` function for iOS 14+.
8+
39
## v2.18.1
410

511
### CarPlay
612

7-
* Fixed CarPlay crash when calling `CarPlayManager.routePreview()` function.
13+
* Partially fixed CarPlay crash when calling `CarPlayManager.routePreview()` function.
814

915
## v2.18.0
1016

Example/ViewController.swift

+15-1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,12 @@ class ViewController: UIViewController {
237237
guard let delegate = UIApplication.shared.delegate as? AppDelegate else { return }
238238
if let indexedRouteResponse = indexedRouteResponse {
239239
delegate.carPlayManager.previewRoutes(for: indexedRouteResponse)
240+
241+
// debug
242+
// By enabling following lines, it makes easy to reproduce the same crash.
243+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
244+
delegate.carPlayManager.previewRoutes(for: indexedRouteResponse)
245+
}
240246
} else {
241247
delegate.carPlayManager.cancelRoutesPreview()
242248
}
@@ -251,7 +257,15 @@ class ViewController: UIViewController {
251257
}
252258

253259
@IBAction func simulateButtonPressed(_ sender: Any) {
254-
simulationButton.isSelected = !simulationButton.isSelected
260+
// simulationButton.isSelected = !simulationButton.isSelected
261+
262+
let destinationCoordinate = CLLocationCoordinate2D(latitude: 37.957453, longitude: -122.523200)
263+
let waypoint = Waypoint(coordinate: destinationCoordinate, name: "Dropped Pin #\(waypoints.endIndex + 1)")
264+
265+
waypoint.targetCoordinate = destinationCoordinate
266+
waypoints = [waypoint]
267+
268+
requestRoute()
255269
}
256270

257271
@IBAction func clearMapPressed(_ sender: Any) {

Sources/MapboxNavigation/CarPlayManager.swift

-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public class CarPlayManager: NSObject {
102102
private weak var navigationService: NavigationService?
103103
private var idleTimerCancellable: IdleTimerManager.Cancellable?
104104
private var indexedRouteResponse: IndexedRouteResponse?
105-
private let semaphore = DispatchSemaphore(value: 1)
106105

107106
/**
108107
Programatically begins a CarPlay turn-by-turn navigation session.
@@ -654,8 +653,6 @@ extension CarPlayManager {
654653
}
655654

656655
func previewRoutes(for trip: CPTrip) {
657-
semaphore.wait()
658-
defer { semaphore.signal() }
659656

660657
guard let traitCollection = (self.carWindow?.rootViewController as? CarPlayMapViewController)?.traitCollection,
661658
let interfaceController = interfaceController else {

0 commit comments

Comments
 (0)