MKLocalSearch未找到附近的所有餐厅



我在mkmapview上的某个区域内实现了MKLocalSearch,它返回该区域内的餐厅阵列。通过研究,只展示了10家餐厅。有没有办法让MKLocalSearch在一个地区内返回10多家餐厅?这是代码,

MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc]init];
request.naturalLanguageQuery = @"restaurant";
request.region = midRegion;
MKLocalSearch *localSearch = [[MKLocalSearch alloc]initWithRequest:request];
[localSearch startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) {
    NSMutableArray *annotations = [NSMutableArray array];
    [response.mapItems enumerateObjectsUsingBlock:^(MKMapItem *item, NSUInteger idx, BOOL *stop){
        CustomAnnotation *annotation = [[CustomAnnotation alloc] initWithPlacemark:item.placemark];
        annotation.title = item.name;
        annotation.subtitle = item.placemark.addressDictionary[(NSString *)kABPersonAddressStreetKey];
        annotation.phone = item.phoneNumber;
        [annotations addObject:annotation];
    }];
    [self.mapView addAnnotations:annotations];
 }];
}       

所以,尽管我已经有一段时间没有问这个问题了,但我仍然想回答,因为我认为我应该回答。在stackoverflow和苹果开发者论坛上偶然发现各种链接后,内置的MKLocalSearch方法似乎被限制为最多返回10个结果。然而,谷歌地图API可以返回多达60个结果。因此,恐怕我的问题的答案是

,您无法使用MKLocalSearch方法返回与特定naturalLanguageQuery关键字相关的区域内的10个以上位置。

最新更新