Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Location manager crash fix when a selector is not implemented #474

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
### 🐞 Bug fixes

* Fixed an issue where completion blocks were not called until the map was rendered. ([#463](https://github.com/mapbox/mapbox-gl-native-ios/pull/463))
* Fixed an issue that caused a crash when custom location managers did not implement `MGLLocationManager.accuracyAuthorization`. ([#474](https://github.com/mapbox/mapbox-gl-native-ios/pull/474))

## 6.2.0 - September 17, 2020

Expand Down
3 changes: 2 additions & 1 deletion platform/ios/src/MGLFaux3DUserLocationAnnotationView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ - (void)update
{
if (@available(iOS 14, *)) {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
if (self.mapView.locationManager.accuracyAuthorization == CLAccuracyAuthorizationFullAccuracy) {
if (![self.mapView.locationManager respondsToSelector:@selector(accuracyAuthorization)] ||
self.mapView.locationManager.accuracyAuthorization == CLAccuracyAuthorizationFullAccuracy) {
[self drawPreciseLocationPuck];
} else {
[self drawApproximate];
Expand Down
2 changes: 2 additions & 0 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6481,9 +6481,11 @@ - (void)locationManagerDidChangeAuthorization:(id<MGLLocationManager>)manager
if (@available(iOS 14, *)) {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
if (self.userTrackingMode != MGLUserTrackingModeNone &&
[manager respondsToSelector:@selector(authorizationStatus)] &&
(manager.authorizationStatus != kCLAuthorizationStatusRestricted ||
manager.authorizationStatus != kCLAuthorizationStatusAuthorizedAlways ||
manager.authorizationStatus != kCLAuthorizationStatusAuthorizedWhenInUse) &&
[manager respondsToSelector:@selector(accuracyAuthorization)] &&
manager.accuracyAuthorization == CLAccuracyAuthorizationReducedAccuracy &&
[self accuracyDescriptionString] != nil ) {
[self.locationManager requestTemporaryFullAccuracyAuthorizationWithPurposeKey:@"MGLAccuracyAuthorizationDescription"];
Expand Down