【发布时间】:2013-02-08 18:27:24
【问题描述】:
GMSReverseGeocodeResponse 包含
- (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 添加到应用程序密钥。控制台中不会打印任何错误。我的意思是我不知道这些行的内容。
【问题讨论】:
-
我在 google maps ios sdk code.google.com/p/gmaps-api-issues/issues/detail?id=4974987654321@ 中打开了一个请求
-
"
GMSGeocoder现在通过GMSAddress提供结构化地址,不推荐使用GMSReverseGeocodeResult。" - Google Maps SDK for iOS Release Notes, Version 1.7, February 2014. -
是的,它已被 Google 修复(大约 1 年后)。我只是不知道如何结束这个问题。
标签: ios google-maps-sdk-ios reverse-geocoding