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

Commit

Permalink
Location manager crash fix when a selector is not implemented (#474)
Browse files Browse the repository at this point in the history
* Fix a location manager crash when a selector is not implemented

* Update changelog
  • Loading branch information
fabian-guerra committed Sep 23, 2020
1 parent eee451e commit 02f04de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
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

0 comments on commit 02f04de

Please sign in to comment.