簡體   English   中英

MKLocalSearch找不到附近的所有餐廳

[英]MKLocalSearch not finding all nearby restaurants

我在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和Apple開發者論壇上的各個鏈接之后,似乎內置的MKLocalSearch方法被限制為最多返回10個結果。 而Google Maps API最多可以返回60個結果。 因此,我的問題恐怕是

不可以 ,您無法使用MKLocalSearch方法返回與特定naturalLanguageQuery關鍵字相關聯的區域內的10個以上位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM