目前在请求“restaurant”类型的 mklocalsearch 请求(显示附近的餐馆)时使用苹果的 iOS 应用程序的地图视图,我得到的只是在设备上运行时美国的餐馆,而不是在当前位置(黎巴嫩)获取附近的餐馆.
这是我认为的代码确实在美国的日志餐厅加载了结果打印
_mapview.showsUserLocation=YES;
_mapview.delegate=self;
MKLocalSearchRequest *request =
[[MKLocalSearchRequest alloc] init];
request.naturalLanguageQuery=@"Restaurant";
request.region = _mapview.region;
MKLocalSearch *search =
[[MKLocalSearch alloc]initWithRequest:request];
[search startWithCompletionHandler:^(MKLocalSearchResponse
*response, NSError *error) {
if (response.mapItems.count == 0)
NSLog(@"No Matches");
else
for (MKMapItem *item in response.mapItems)
{
NSLog(@"name = %@", item.name);
NSLog(@"Phone = %@", item.phoneNumber);
}
}];