CLGeocoder返回其他国家/地区的位置 [英] CLGeocoder returning locations in other countries

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

问题描述

我有以下代码:

CLGeocoder *_geo = [[CLGeocoder alloc] init];
CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter: CLLocationCoordinate2DMake(37.33233141, -122.03121860) radius:100 identifier:@"San Francisco"];
[_geo geocodeAddressString:@"Starbucks" inRegion:region
             completionHandler:^(NSArray *placemarks, NSError *error)
{
    NSLog("%@", placemarks);
}];

这将返回菲律宾的星巴克位置,即使该中心位于旧金山市中心。 / p>

This returns a Starbucks location in the Philippines even though the center is in the middle of San Francisco.

(NSArray *) $3 = 0x07cd9d10 <__NSArrayM 0x7cd9d10>(
Starbuck's, Metro Manila, Quezon City, Republic of the Philippines @ <+14.63617752,+121.03067530> +/- 100.00m, region (identifier <+14.63584900,+121.02951050> radius 166.35) <+14.63584900,+121.02951050> radius 166.35m
)

任何想法?

推荐答案

虽然看起来似乎不太可能,但似乎a)Apple不打算在某个地区附近转发地理编码业务名称,或者b)这是一个错误。

Though it seems unlikely, it certainly appears that either a) Apple didn't intend on forward geocoding business names near a region, or b) this is a bug.

CLGeocoder参考,在其概述中,陈述:

The CLGeocoder reference, in its overview, states:


Forward-geo编码请求采用用户可读的地址并找到相应的纬度和经度值...

Forward-geocoding requests take a user-readable address and find the corresponding latitude and longitude value...

这当然意味着一个真实的物理地址搜索字符串(尤其是用户可读地址部分)。但是, geocodeAddressString:inRegion:completionHandler:的文档声明搜索字符串为:

which certainly implies a real physical address as the search string (especially the "user-readable address" part). However, the docs for geocodeAddressString: inRegion: completionHandler: states that the search string is:


...描述你要查找的位置的字符串...

... a string describing the location you want to look up...

这更加模糊。我尝试运行你的代码,代码与它非常相似,通过我的几个项目得到了相同的结果。 甚至Apple的 GeocoderDemo示例展示了这个问题(虽然我居住在加利福尼亚州距离你的纬度/长的例子大约150英里),所以我们当中没有人写过。

which is even more vague. I tried running your code, and code very similar to it, through a couple of my projects and I get the same result. Even Apple's GeocoderDemo sample exhibits the problem (although I live in California just ~150 miles from your lat/long example), so it's certainly nothing either of us have written.

我出发了希望与您一起帮助解决这个问题!但是,这一点是研究就是我所拥有的。祝你好运。

I set out looking to help solve this problem for/with you! But, this bit of is research is all I've got. Best of luck.

这篇关于CLGeocoder返回其他国家/地区的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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