CLGeocoder仅返回一个地标 [英] CLGeocoder Only Returning One Placemark

查看:119
本文介绍了CLGeocoder仅返回一个地标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到CLGeocoder的问题,当我调用 geocodeAddressString:withCompletionHandler 时,尽管知道输入的字符串应该返回多个值,但我只得到一个结果。类引用甚至指出:

I have a problem with CLGeocoder where when I call geocodeAddressString:withCompletionHandler I only ever get one result back, despite knowing that the inputted string should return more than one value. The class reference even states:


在前向地理编码请求的情况下,如果提供的信息产生多个可能,则可以返回多个地标对象location。

In the case of forward-geocoding requests, multiple placemark objects may be returned if the provided information yielded multiple possible locations.

但是,我的地标数组只有一个项目:

However, my placemarks array only ever has one item in it:

    [geocoderDestination geocodeAddressString:destination completionHandler:^(NSArray *placemarks, NSError *error){
NSLog(@"array count:%i", [placemarks count];}

感谢您的帮助。

我使用了Piccadilly,UK,Union Street,UK之类的字符串,这些字符串只返回了一个结果。现在我想到了,将英国放在最后可能是一个促成因素。

I have used strings such as "Piccadilly, UK", "Union Street, UK" which have only returned one result. Now that I think about it, putting UK on the end might be the contributing factor.

推荐答案

我不知道CLGeocoder,但如果你的要求是位置搜索另一种方式是使用谷歌位置搜索网址 http://maps.google.com/maps/geo?q=london ,它返回包含匹配位置信息的json。

I dont know about CLGeocoder but if your requirement is a location search another way is to use google location search url http://maps.google.com/maps/geo?q=london which returns a json containing the matched location information.

这篇关于CLGeocoder仅返回一个地标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆