-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Refactor iOS location authorization delegate method #1598
Refactor iOS location authorization delegate method #1598
Conversation
This new delegate method passes along the `didChangeAuthorizationStatus` CoreLocation delegate method.
This method was not being called when location authorization status was changing, making it unnecessary.
It’s also worth noting that MapKit provides for an |
Did you try sticking the phone next to a stereo or in a refrigerator, @friedbunny? 😉 |
@1ec5 I don't know why This does sound like it should work, though: typedef NS_ENUM(NSInteger, CLError) {
...
kCLErrorDenied, // Access to location or ranging has been denied by the user
...
} In any case, we weren't passing anything besides |
Parity is a good reason to keep this, but we'll have to change it to pass everything through. |
…nt pass-thru for CoreLocation
As much as I wanted to kill |
Yeah we should keep it for parity. |
MapKit's didFailToLocateUserWithError: Error Domain=MKLocationErrorDomain Code=0 "The operation couldn’t be completed. (MKLocationErrorDomain error 0.)" UserInfo=0x1850a030 {NSLocalizedRecoverySuggestion=Turn On Location Services to Allow (null) to Determine Your Location}
didFailToLocateUserWithError: Error Domain=kCLErrorDomain Code=1 "The operation couldn’t be completed. (kCLErrorDomain error 1.)" I'll keep looking into why we aren't getting |
OK, figured it out: we were turning off the location manager before it got to By setting - (void)locationManager:(__unused CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
if (status == kCLAuthorizationStatusDenied || status == kCLAuthorizationStatusRestricted)
{
self.userTrackingMode = MGLUserTrackingModeNone;
self.showsUserLocation = NO;
}
} Using I think we should get rid of the checks in |
Closed in favor of #1608. |
This pull request adds
[MGLMapView mapView:didChangeLocationAuthorizationStatus:]
as a pass-thru delegate method for[CLLocationManager locationManager:didChangeAuthorizationStatus:]
.This PR
also removes[MGLMapView mapView:didFailToLocateUserWithError:]
, because it was never being called when user location permissions changed. In my testing on iOS 7 & 8, on device and in sim, I never got this method to fire. It may still be useful for other purposes or catastrophic cases that I can't easily test for, but not for reliably indicating location permission authorization.I didn't deprecateUpdate: readded[MGLMapView mapView:didFailToLocateUserWithError:]
— should we?mapView:didFailToLocateUserWithError:
for MapKit parity./cc @1ec5 @incanus @bleege