GMSReverseGeocodeResponse 包含
- (GMSReverseGeocodeResult *)firstResult;
Run Code Online (Sandbox Code Playgroud)
其定义如下:
@interface GMSReverseGeocodeResult : NSObject<NSCopying>
/** Returns the first line of the address. */
- (NSString *)addressLine1;
/** Returns the second line of the address. */
- (NSString *)addressLine2;
@end
Run Code Online (Sandbox Code Playgroud)
有没有办法从这两个字符串中获取国家,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 ) ;
} ] ;
Run Code Online (Sandbox Code Playgroud)
但由于某种原因,处理程序从未被调用过.我确实添加了应用密钥,并且还将iOS捆绑包ID添加到了应用密钥.控制台中未打印错误.有了这个,我的意思是我不知道线条的内容.