GMSReverseGeocodeResponse
包含如何從reverseGeocodeCoordinate獲取國家,州,城市?
- (GMSReverseGeocodeResult *)firstResult;
,其定義是這樣的:
@interface GMSReverseGeocodeResult : NSObject<NSCopying>
/** Returns the first line of the address. */
- (NSString *)addressLine1;
/** Returns the second line of the address. */
- (NSString *)addressLine2;
@end
有來自這兩個字符串的任何方式來獲得全國,ISO國家代碼,州(administrative_area_1或相應的一個)(有效期所有國家和所有地址)?
注:我試圖執行這段代碼
[[GMSGeocoder geocoder] reverseGeocodeCoordinate:CLLocationCoordinate2DMake(40.4375, -3.6818) completionHandler:^(GMSReverseGeocodeResponse *resp, NSError *error)
{
NSLog(@"Error is %@", error) ;
NSLog(@"%@" , resp.firstResult.addressLine1) ;
NSLog(@"%@" , resp.firstResult.addressLine2) ;
} ] ;
但由於某些原因,處理程序從未被調用。我確實添加了應用程序密鑰,並且還將iOS捆綁軟件ID添加到了應用程序密鑰中。控制檯中沒有打印錯誤。我的意思是我不知道這些行的內容。
我已經在谷歌地圖中打開了一個請求ios sdk http://code.google.com/p/gmaps-api-issues/issues/detail?id=4974 – user2101384 2013-02-23 09:41:11
「'GMSGeocoder'現在通過'GMSAddress提供結構化地址',棄用'GMSReverseGeocodeResult'。「 - [Google Maps SDK for iOS版本說明,版本1.7,2014年2月](https://developers.google.com/maps/documentation/ios/releases#version_17_-_february_2014)。 – Pang 2014-02-13 02:32:46
是的,它由谷歌(近1年後)修復。我只是不知道如何解決這個問題。 – user2101384 2014-02-13 11:27:09