MKLocalSearch找不到明显的结果

我的代码实际上与以下示例相同:

https://github.com/iamamused/Example-MKLocalSearch.git

这里有一些重要的部分:

@interface ViewController : UIViewController @property (strong, nonatomic) IBOutlet MKMapView *ibMapView; @end @implementation ViewController { MKLocalSearch *localSearch; MKLocalSearchResponse *results; } - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { [localSearch cancel]; MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc] init]; request.naturalLanguageQuery = searchBar.text; request.region = self.ibMapView.region; localSearch = [[MKLocalSearch alloc] initWithRequest:request]; [localSearch startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error){ [self.resultTable reloadData]; } } 

当Sutter和Mason aka 600 Sutter St.在地图区域内寻找“600 Sutte”时,包括明显的结果“600 Sutter St.”似乎是合理的。 我只是无法得到这个工作。 我已经尝试了很多不同的街道,而且我经常在地图区域直接得到结果之前得到结果。

另外,“600 Sut”返回不相关的结果,而“600 Su”返回错误4.是不是真的没有find以“600 Su”开头的内容?

我使用这个API是完全错误还是不是为了我想用它做什么?

所有查询的地图区域: 地图区域

600 Sutte 600 Sutte

600苏 600苏

我最终放弃了苹果本地searchAPI并切换到Google。 他们的地方API正是我所需要的。 它可以快速find相关的结果,每天最多10万个请求不会花费任何费用。

自动完成: https : //developers.google.com/places/documentation/autocomplete

详细信息(需要lat,lon): https : //developers.google.com/places/documentation/details

在JSONModel的帮助下,我在几个小时内将其构build到iOS应用程序中。

结果正是我希望看到的:

在这里输入图像说明

@borisz – 太less点直接评论..谨防在您的IOS应用程序中使用Google Places API。 Google在条款和条件中声明,任何显示从Google Places API获取的数据的地图都必须是Google地图。 所以,如果你仍然希望使用他们的API和search,只要确保你使用的是Google Map而不是Apple的原生地图。 希望这有帮助,祝你好运!