This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
Crash updating user location indicator on iOS 14 with custom location manager — -[MGLFaux3DUserLocationAnnotationView update] #470
Labels
Milestone
On iOS 14, a crash occurs as soon as a location update comes in after setting
MGLMapView.locationManager
to an MGLLocationManager implementation that has not been updated to implement theaccuracyAuthorization
property and-locationManagerDidChangeAuthorization:
method.Crash details
As of iOS navigation SDK v1.0.0-rc.4, the PassiveLocationManager class added in mapbox/mapbox-navigation-ios#2410 doesn’t implement these methods – mapbox/mapbox-navigation-ios#2554 – leading to the following crash:
Diagnosis
The immediate issue is that this code refers to the
accuracyAuthorization
property, which is unimplemented by PassiveLocationManager and thus missing from the object’s storage:mapbox-gl-native-ios/platform/ios/src/MGLFaux3DUserLocationAnnotationView.mm
Line 62 in 3501f47
mapbox/mapbox-navigation-ios#2554 tracks updating the PassiveLocationManager implementation to somehow include the new iOS 14 members. Even so, a developer would be forgiven for omitting this implementation, because it’s marked as an optional member in the header:
mapbox-gl-native-ios/platform/darwin/src/MGLLocationManager.h
Line 21 in 3501f47
mapbox-gl-native-ios/platform/darwin/src/MGLLocationManager.h
Lines 61 to 71 in 3501f47
In fact, plenty of other code throughout MGLMapView makes use of these ostensibly optional members, potentially setting up a situation for a crash:
mapbox-gl-native-ios/platform/ios/src/MGLMapView.mm
Line 6547 in d6190f5
Expected behavior
MGLMapView should check that any optional method or property of MGLLocationManager is implemented before using it.
In theory, it would be within the map SDK’s purview to make
accuracyAuthorization
and-locationManagerDidChangeAuthorization:
required. However, that would be oddly inconsistent with the rest of the MGLLocationManager protocol, including more prominent members such aslocation
andheading
. Moreover, it would technically be a backwards-incompatible change./ref #381 (comment)
/cc @mapbox/maps-ios @mapbox/navigation-ios @mapbox/1tap-ios
The text was updated successfully, but these errors were encountered: