Skip to content

Commit

Permalink
Fix getCurrentPosition
Browse files Browse the repository at this point in the history
Summary:
Instantiates the _pendingRequests array before trying to add to it. As it currently stands, we try to add the pending request before the array is created. getCurrentPosition always fails on the first try.
Closes #4764

Reviewed By: svcscm

Differential Revision: D2764751

Pulled By: androidtrunkagent

fb-gh-sync-id: 411a03ff16d40725d8cc0909607632045eb5a27b
  • Loading branch information
Marc Shilling authored and facebook-github-bot-0 committed Dec 16, 2015
1 parent 92fb0c4 commit f48dbbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Libraries/Geolocation/RCTLocationObserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ - (void)beginLocationUpdates
_locationManager = [CLLocationManager new];
_locationManager.distanceFilter = RCT_DEFAULT_LOCATION_ACCURACY;
_locationManager.delegate = self;
_pendingRequests = [NSMutableArray new];
}

// Request location access permission
Expand Down Expand Up @@ -234,6 +233,9 @@ - (void)timeout:(NSTimer *)timer
selector:@selector(timeout:)
userInfo:request
repeats:NO];
if (!_pendingRequests) {
_pendingRequests = [NSMutableArray new];
}
[_pendingRequests addObject:request];

// Configure location manager and begin updating location
Expand Down

0 comments on commit f48dbbe

Please sign in to comment.