Skip to content

Commit

Permalink
Fix ios regeocode
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuxiang committed May 5, 2019
1 parent fb3ef9b commit 1a68ce5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/ios/AMapGeolocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ @implementation AMapGeolocation {
}

- (id)json:(CLLocation *)location reGeocode:(AMapLocationReGeocode *)reGeocode {
if (reGeocode && reGeocode.formattedAddress.length) {
if (reGeocode) {
return @{
@"accuracy" : @(location.horizontalAccuracy),
@"latitude" : @(location.coordinate.latitude),
Expand All @@ -70,16 +70,16 @@ - (id)json:(CLLocation *)location reGeocode:(AMapLocationReGeocode *)reGeocode {
@"speed" : @(location.speed),
@"heading" : @(location.course),
@"timestamp" : @(location.timestamp.timeIntervalSince1970 * 1000),
@"address" : reGeocode.formattedAddress,
@"poiName" : reGeocode.POIName ? reGeocode.POIName : "",
@"country" : reGeocode.country ? reGeocode.country : "",
@"province" : reGeocode.province ? reGeocode.country : "",
@"city" : reGeocode.city ? reGeocode.city : "",
@"cityCode" : reGeocode.citycode ? reGeocode.citycode : "",
@"district" : reGeocode.district ? reGeocode.district : "",
@"street" : reGeocode.street ? reGeocode.street : "",
@"streetNumber" : reGeocode.number ? reGeocode.number : "",
@"adCode" : reGeocode.adcode ? reGeocode.adcode : "",
@"address" : reGeocode.formattedAddress ? reGeocode.formattedAddress : @"",
@"poiName" : reGeocode.POIName ? reGeocode.POIName : @"",
@"country" : reGeocode.country ? reGeocode.country : @"",
@"province" : reGeocode.province ? reGeocode.country : @"",
@"city" : reGeocode.city ? reGeocode.city : @"",
@"cityCode" : reGeocode.citycode ? reGeocode.citycode : @"",
@"district" : reGeocode.district ? reGeocode.district : @"",
@"street" : reGeocode.street ? reGeocode.street : @"",
@"streetNumber" : reGeocode.number ? reGeocode.number : @"",
@"adCode" : reGeocode.adcode ? reGeocode.adcode : @"",
};
} else {
return @{
Expand Down

0 comments on commit 1a68ce5

Please sign in to comment.