我正在使用Apple Maps获取当地的地址列表。然而,它似乎返回来自世界各地的结果,而不是我指定的地图区域。
我正在使用以下代码,并检查了该区域,以确保它是具有相同参数的mapView的“广泛”整个伦敦(见附件)。然而,在我的结果中,我有时会在德国,美国或南美的地点。
有人看得出我做错了什么吗?
MKLocalSearchRequest* request = [[MKLocalSearchRequest alloc] init];
request.naturalLanguageQuery = searchTerm;
CLLocationCoordinate2D cornerCoordinate = CLLocationCoordinate2DMake(51.5007282, -0.1246263);
request.region = MKCoordinateRegionMakeWithDistance(cornerCoordinate, 50000, 50000);
MKLocalSearch* search = [[MKLocalSearch alloc] initWithRequest:request];
[search startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) {
//results come in here
}];映射区域:

发布于 2015-08-16 15:35:15
根据文档:
指定区域的
不能保证结果都在该区域内。这只是对搜索引擎的一个提示。
这很糟糕,但不幸的是,没有办法将结果限制在所提供的区域。
为此,您可以考虑使用Google Places API:https://developers.google.com/places/webservice/autocomplete
发布于 2014-11-12 18:12:25
尝试此解决方案。在这里,我认为问题是因为您指定的区域。
MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc] init];
request.naturalLanguageQuery = searchTerm;
MKCoordinateSpan span = MKCoordinateSpanMake(.1, .1);
CLLocationCoordinate2D cornerCoordinate = CLLocationCoordinate2DMake(51.5007282, -0.1246263);
request.region = MKCoordinateRegionMake(cornerCoordinate, span);
MKLocalSearch *search = [[MKLocalSearch alloc] initWithRequest:request];
[search startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) {
}];https://stackoverflow.com/questions/26884042
复制相似问题