Ask for 'always' location permissions, too

This commit is contained in:
Jason Wray
2015-07-21 18:09:48 -04:00
parent 765c4695d8
commit 92d9308eb8

View File

@@ -2214,7 +2214,15 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
[NSException raise:@"Missing Location Services usage description" format:
@"In iOS 8 and above, this app must have a value for NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in its Info.plist."];
}
[self.locationManager requestWhenInUseAuthorization];
// request location permissions, if both keys exist ask for less permissive
if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"])
{
[self.locationManager requestWhenInUseAuthorization];
}
else if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"])
{
[self.locationManager requestAlwaysAuthorization];
}
}
#endif