Skip to content
This repository was archived by the owner on Sep 4, 2021. It is now read-only.

Commit ce8ad12

Browse files
author
Yann Pringault
committed
On new request cancel the previous one (iOS)
1 parent e1f3c6c commit ce8ad12

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ both iOS and Android will return the following object:
131131
## Notes
132132

133133
### iOS
134-
iOS does not allow sending multiple geocoding requests simultaneously, unless you enable the fallbackToGoogle to handle the parallel calls when an native iOS request is active.
134+
iOS does not allow sending multiple geocoding requests simultaneously, hence if you send a second call, the first one will be cancelled.
135135

136136
### Android
137137
geocoding may not work on older android devices (4.1) and will not work if Google play services are not available.

ios/RNGeocoder/RNGeocoder.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ @implementation RNGeocoder
3131
}
3232

3333
if (self.geocoder.geocoding) {
34-
return reject(@"NOT_AVAILABLE", @"geocodePosition busy", nil);
34+
[self.geocoder cancelGeocode];
3535
}
3636

3737
[self.geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) {
@@ -58,7 +58,7 @@ @implementation RNGeocoder
5858
}
5959

6060
if (self.geocoder.geocoding) {
61-
return reject(@"NOT_AVAILABLE", @"geocodeAddress busy", nil);
61+
[self.geocoder cancelGeocode];
6262
}
6363

6464
[self.geocoder geocodeAddressString:address completionHandler:^(NSArray *placemarks, NSError *error) {

0 commit comments

Comments
 (0)