简体   繁体   English

IOS 的 getFromLocationName() 替代品是什么?

[英]What is the replacement for getFromLocationName() for IOS?

I have implemented google map on IOS, now i want to locate marker on some company brand name, before i have experience of implementing in Android.我已经在 IOS 上实现了谷歌地图,现在我想在一些公司品牌名称上定位标记,然后我才有在 Android 中实现的经验。 In Android getFromLocationName() to get the address info like lat, long from geocoder but I am not getting any in build function like this in IOS?在 Android getFromLocationName() 中从地理编码器获取像纬度、长这样的地址信息,但我在 IOS 中没有得到这样的构建函数?

any help?有什么帮助吗?

i think its giving you error because, geocoder is not able to find the location.我认为它给了你错误,因为地理编码器无法找到位置。

check this code ,检查此代码,

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM