我从网络服务获得 82 个地址,并且我正在使用正向地理编码器。现在如何在 mapview 上一次显示所有 82 个地址。我将代码放在 for 循环中,但它会抛出错误“对此 API 密钥进行了太多查询”。有没有办法发送所有地址并获取所有地址的位置?这是我在 for 循环中的代码...
NSMutableDictionary *dictLoc = [[self.arrObjects objectAtIndex:indexValue]valueForKey:@"object_location"];
NSString *searchString = [NSString stringWithFormat:@"%@,%@,%@,%@",[dictLoc valueForKey:@"object_location_number"],[dictLoc valueForKey:@"object_location_street"],[dictLoc valueForKey:@"object_location_city"],[dictLoc valueForKey:@"object_location_zip"]];
// if (self.forwardGeocoder == nil) {
BSForwardGeocoder *forwardGeocoder = [[[BSForwardGeocoder alloc] initWithDelegate:self] autorelease];
// }
CLLocationCoordinate2D southwest, northeast;
southwest.latitude = 34.172684;
southwest.longitude = -118.604794;
northeast.latitude = 34.236144;
northeast.longitude = -118.500938;
BSForwardGeocoderCoordinateBounds *bounds = [BSForwardGeocoderCoordinateBounds boundsWithSouthWest:southwest northEast:northeast];
// Forward geocode!
#if NS_BLOCKS_AVAILABLE
[forwardGeocoder forwardGeocodeWithQuery:searchString regionBiasing:nil viewportBiasing:bounds success:^(NSArray *results) {
[self forwardGeocodingDidSucceed:forwardGeocoder withResults:results withIndexValue:indexValue];
} failure:^(int status, NSString *errorMessage) {
if (status == G_GEO_NETWORK_ERROR) {
[self forwardGeocoderConnectionDidFail:forwardGeocoder withErrorMessage:errorMessage];
}
else {
[self forwardGeocodingDidFail:forwardGeocoder withErrorCode:status andErrorMessage:errorMessage];
}
}];
#else
[self.forwardGeocoder forwardGeocodeWithQuery:searchString regionBiasing:nil viewportBiasing:nil];
#endif
提前致谢.. :)