0

MKReverseGeoCoder API を使用して、座標に基づいて都市名を取得しようとしています。何らかの理由でデリゲートが呼び出されません。なぜアイデアはありますか?コードは次のとおりです。

- (void)startReverseLookup
{
  [reverseCoordinateInfo initWithCoordinate:self.currentlocation.coordinate];
  [reverseCoordinateInfo setDelegate:self];
  [reverseCoordinateInfo  start];
  NSLog(@"Reverse Geocode started");
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
     {
      NSLog(@"RC - ERROR !!!");
      }

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark    *)placemark
 {
     NSLog(@"RC lookup finished !! - Locality is:%@",placemark.locality);
 }  

.h ファイルでプロトコルを宣言してから、startReverseLookup を呼び出します。最初の NSLog が表示されますが、その後は何も起こりません。ただ永遠にそこにとどまり、どちらのメソッドでもデリゲートが呼び出されることはありません。助言がありますか?

4

1 に答える 1

0

次のメソッドを変更します -

- (void)startReverseLookup
{
    reverseCoordinateInfo = [[MKReverseGeocoder alloc] initWithCoordinate:self.currentlocation.coordinate];
    [reverseCoordinateInfo setDelegate:self];
    [reverseCoordinateInfo  start];
    NSLog(@"Reverse Geocode started");
} 
于 2011-04-07T08:24:54.583 に答える