私はMapViewを表示する簡単なアプリを持っています。 ユーザーが地図ビュー上でズーム位置をスクロールまたは変更すると、マップの中央にある国名を表示したいとします。iPhone - 逆ジオコーディングで「操作を完了できませんでした(PBRequesterErrorDomainエラー6001.)」エラー
だから私はこれを行う:ビューはそう何より毎秒1つのコールという、スクロール終了したときに
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
MKReverseGeocoder *reverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:self.mapView.centerCoordinate];
reverseGeocoder.delegate = self;
[reverseGeocoder start];
}
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated {
self.countryNameLabel.text = @"";
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark {
self.countryNameLabel.text = placemark.country;
}
- (void) reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error {
self.countryNameLabel.text = [error localizedDescription];
NSLog(@"%@", [error localizedDescription]);
}
をregionDidChangeAnimatedメソッドのみが呼び出されません。
場合によっては、「操作を完了できませんでした(PBRequesterErrorDomainエラー6001.)」というエラーが表示され、国名を表示できません。 地図ビューを少し移動すると問題が解決され、国が表示されます。
ユーザーがマップビューの表示を変更するたびに国名を表示できるようにするにはどうすればよいですか?
私はthat postを読みましたが、それは役に立ちません。
あなたはmapViewDidFinishingLoadingMapで逆ジオコーディングを開始しようとしましたか? – Mat
@Mat:は動作しません。時々Smaeの問題。ほとんどの場合、地図のコンテンツが既にロードされているため(たとえば、ズームインしてから移動するときなど)、このメソッドは起動されません。 – Oliver