我從webservice獲取82個地址,並使用前向地理編碼器。現在,如何在mapview上一次顯示所有82個地址。我將代碼放在for循環中,但它拋出錯誤「對此API密鑰進行了太多查詢」。有什麼辦法可以發送所有地址並獲取所有地址的位置? 這是我在for循環代碼...在地圖上一次刪除82個針腳
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
在此先感謝.. :)
你可以顯示你在寫什麼for循環 – BhushanVU 2013-02-19 10:08:13
發佈一些代碼或錯誤日誌:) – Rushabh 2013-02-19 10:09:33
我已經添加了代碼..和錯誤我在描述中提到.. :) – Rythm 2013-02-19 10:14:29