Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4034064
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:55:31+00:00 2026-05-20T11:55:31+00:00

Is there a way to wait for geocoder to invoke didFailWithError or didFindPlaceMark? My

  • 0

Is there a way to wait for geocoder to invoke didFailWithError or didFindPlaceMark?

My problem is that i have to call a method that receives coordinate and returns placemark holding the address. But when i call [myGeocoder start] code continues and i get an empty placemark.

My code is:

- (MKPlasemark*) getAddress:(CLLocationCoordinate2D) coordinate
{
    [self startGeocoder:coordinate];
    return self.foundPlasemark;
}

- (void)reverseGeocoder:(MKReverseGeocoder*)geocoder didFindPlacemark:(MKPlaseMark*)plasemark
{    
    self.foundPlasemark=plasemark;    
}

- (void)reverseGeocoder:(MKReverseGeocoder*)geocoder didFailWithError:(NSError*)error
{    
    self.foundPlasemark=nil;    
}

I tryed to perform sleep() whyle one of the following methods invoked, but it didn’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:55:32+00:00Added an answer on May 20, 2026 at 11:55 am

    I think you are going about it the wrong way, there is no reason to block, what you have to do is have that method return void, and in the class that is handling the geocoding, define a protocol that has a method say -(void)didReceivePlacemark:(id)placemark, placemark can be nil or some placemark, and it is called when the geocoder returns. You also make a delegate property for your class so anyone can subscribe to the protocol… Then in the calling class subscribe to the protocol and implement the method…heres a bit more on protocols

    Hope that helps
    Here is an example:
    So the interface of your class that does the geocoding will look something like this

    @protocol GeocoderControllerDelegate
      -(void)didFindGeoTag:(id)sender; // this is the call back method 
    
    
    @end
    
    @interface GeocoderController : NSObject {
    
        id delegate;
    }
    @property(assign) id <GeocoderControllerDelegate> delegate; 
    

    Then in the implementation you would see something like this

    - (void) getAddress:(CLLocationCoordinate2D) coordinate
    {
        [self startGeocoder:coordinate];
    }
    
    - (void)reverseGeocoder:(MKReverseGeocoder*)geocoder didFindPlacemark:(MKPlaseMark*)plasemark
    {    
       [delegate didFindGeoTag:plasemark]; 
    }
    
    - (void)reverseGeocoder:(MKReverseGeocoder*)geocoder didFailWithError:(NSError*)error
    {    
       [delegate didFindGeoTag:nil]  
    }
    

    In the calling class, all you have to set is the delegate property of the GeocoderClass, and implement the protocol, the implementation might look somethign like

    -(void)findMethod
    {
    
      GeocoderController *c=...
      [c setDelegate:self];
      [c findAddress];
      //at this point u stop doing anything and just wait for the call back to occur
      //this is much preferable than blocking
    }
    
     -(void)didFindGeoTag:(id)sender
    {
        if(sender)
        { 
           //do something with placemark
        }
        else 
        {
         //geocoding failed
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Erlang is there any way that a message sender can wait on a
Is there a way to implement wait(); (non-static method) in a static context. For
Is there a way to wait for jQuery's getJSON method? I want to parse
I have two questions: Is there a way to insert a ThreadPool functoin that
Is there a way to get send() to wait until all the data that
Is there a better way to wait for queued threads before execute another process?
I was wondering if there's a way to wait for a file to be
Is there a way in PHP to make HTTP calls and not wait for
I'm curious if there is an efficient way to wait for the front page
Is there a way to wait for hide function in a loop? I mean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.