From 581a5ddf8e6c9dd62272211d2fd47c7b2bd6bbea Mon Sep 17 00:00:00 2001 From: ngandhy Date: Mon, 8 Jan 2018 15:43:02 -0800 Subject: [PATCH 1/2] re #17486 - set _locationManager if auth skipped make sure locationManager is being set before continuing. Used if !locationManager vs else on previous statement as we should NEVER enter this code without _locationManager set. Also the else version might experience issues if someone touches the auth code and doesn't check this case, so seems more "long term stable". --- Libraries/Geolocation/RCTLocationObserver.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Libraries/Geolocation/RCTLocationObserver.m b/Libraries/Geolocation/RCTLocationObserver.m index 4ea8a57dc1ea56..8d62541d11ec32 100644 --- a/Libraries/Geolocation/RCTLocationObserver.m +++ b/Libraries/Geolocation/RCTLocationObserver.m @@ -158,6 +158,12 @@ - (void)beginLocationUpdatesWithDesiredAccuracy:(CLLocationAccuracy)desiredAccur if (!_locationConfiguration.skipPermissionRequests) { [self requestAuthorization]; } + + //re #17486 - If someone skips permissions, location manager is not being set. so lets make sure its set before continuing + if (!_locationManager) { + _locationManager = [CLLocationManager new]; + _locationManager.delegate = self; + } _locationManager.distanceFilter = distanceFilter; _locationManager.desiredAccuracy = desiredAccuracy; From 6bfb879d321a36c02efd851ba71f8ab3a1d26e83 Mon Sep 17 00:00:00 2001 From: ngandhy Date: Fri, 12 Jan 2018 17:30:07 -0800 Subject: [PATCH 2/2] Remove unnecessary comment removed unnecessary comment - see https://github.com/facebook/react-native/pull/17487#pullrequestreview-88630001 --- Libraries/Geolocation/RCTLocationObserver.m | 1 - 1 file changed, 1 deletion(-) diff --git a/Libraries/Geolocation/RCTLocationObserver.m b/Libraries/Geolocation/RCTLocationObserver.m index 8d62541d11ec32..11b344a6f46cf1 100644 --- a/Libraries/Geolocation/RCTLocationObserver.m +++ b/Libraries/Geolocation/RCTLocationObserver.m @@ -159,7 +159,6 @@ - (void)beginLocationUpdatesWithDesiredAccuracy:(CLLocationAccuracy)desiredAccur [self requestAuthorization]; } - //re #17486 - If someone skips permissions, location manager is not being set. so lets make sure its set before continuing if (!_locationManager) { _locationManager = [CLLocationManager new]; _locationManager.delegate = self;