问题描述
我遇到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:
但是,我的地标数组只有一个项目:
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,但如果你的要求是位置搜索另一种方式是使用谷歌位置搜索网址,它返回包含匹配位置信息的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仅返回一个地标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!