2015-12-21 61 views
0

我無法說服爲什麼postalCode在iOS Google地圖SDK中獲得(null)。以下是我的代碼。iOS中的郵政編碼獲得(null)Google Maps SDK反向地理編碼

[[GMSGeocoder geocoder] reverseGeocodeCoordinate:CLLocationCoordinate2DMake(place.coordinate.latitude, place.coordinate.longitude) completionHandler:^(GMSReverseGeocodeResponse* response, NSError* error) { 
       NSLog(@"reverse geocoding results:"); 
       for(GMSAddress* addressObj in [response results]) 
       { 
        NSLog(@"coordinate.latitude=%f", addressObj.coordinate.latitude); 
        NSLog(@"coordinate.longitude=%f", addressObj.coordinate.longitude); 
        NSLog(@"thoroughfare=%@", addressObj.thoroughfare); 
        NSLog(@"locality=%@", addressObj.locality); 
        NSLog(@"subLocality=%@", addressObj.subLocality); 
        NSLog(@"administrativeArea=%@", addressObj.administrativeArea); 
        NSLog(@"postalCode=%@", addressObj.postalCode); 
        NSLog(@"country=%@", addressObj.country); 
        NSLog(@"lines=%@", addressObj.lines); 

       } 
      }]; 

這裏是上述編碼的結果。

2015-12-21 17:36:58.138 coordinate.latitude=51.509980 
2015-12-21 17:36:58.138 coordinate.longitude=-0.133700 
2015-12-21 17:36:58.138 thoroughfare=(null) 
2015-12-21 17:36:58.138 locality=London 
2015-12-21 17:36:58.138 subLocality=(null) 
2015-12-21 17:36:58.139 administrativeArea=(null) 
2015-12-21 17:36:58.139 postalCode=(null) 
2015-12-21 17:36:58.139 country=United Kingdom 
2015-12-21 17:36:58.142 lines=(
    "", 
    "London, UK" 
) 

請幫我解決這個問題。

回答

0

我是Google Maps SDK for iOS的工程師。乍一看,這看起來像一個錯誤。你能否在issue tracker上提出問題?這將幫助我們跟蹤這個問題,並針對其他問題確定優先順序。請包括您正在使用的SDK版本以及您嘗試反向地理編碼的座標。

0

您好所有我找到的解決方案,請使用此代碼

[[GMSGeocoder geocoder] reverseGeocodeCoordinate:CLLocationCoordinate2DMake(place.coordinate.latitude, place.coordinate.longitude) completionHandler:^(GMSReverseGeocodeResponse* response, NSError* error) { 
       NSLog(@"reverse geocoding results:"); 
       GMSAddress* addressObj = [response firstResult]; 

        NSLog(@"coordinate.latitude=%f", addressObj.coordinate.latitude); 
        NSLog(@"coordinate.longitude=%f", addressObj.coordinate.longitude); 
        NSLog(@"thoroughfare=%@", addressObj.thoroughfare); 
        NSLog(@"locality=%@", addressObj.locality); 
        NSLog(@"subLocality=%@", addressObj.subLocality); 
        NSLog(@"administrativeArea=%@", addressObj.administrativeArea); 
        NSLog(@"postalCode=%@", addressObj.postalCode); 
        NSLog(@"country=%@", addressObj.country); 
        NSLog(@"lines=%@", addressObj.lines); 


      }]; 
相關問題