[英]What is the replacement for getFromLocationName() for IOS?
我已经在 IOS 上实现了谷歌地图,现在我想在一些公司品牌名称上定位标记,然后我才有在 Android 中实现的经验。 在 Android getFromLocationName() 中从地理编码器获取像纬度、长这样的地址信息,但我在 IOS 中没有得到这样的构建函数?
有什么帮助吗?
我认为它给了你错误,因为地理编码器无法找到位置。
检查此代码,
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:@"Palolem Beach, Goa, India" completionHandler:^(NSArray* placemarks, NSError* error){
if (!error) {
for (CLPlacemark* aPlacemark in placemarks)
{
NSLog(@"place--%@", [aPlacemark locality]);
NSLog(@"lat--%f\nlong--%f",aPlacemark.location.coordinate.latitude,aPlacemark.location.coordinate.longitude);
}
}
else{
NSLog(@"error--%@",[error localizedDescription]);
}
}];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.