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

  • SEARCH
  • Home
  • 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 8656069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:11:18+00:00 2026-06-12T15:11:18+00:00

How can I manage calling an asynchronous block in a loop? My code to

  • 0

How can I manage calling an asynchronous block in a loop?

My code to be called n-times:

- (void) convertToCountries:(NSString*)time longitude:(NSString*)lon latitude:(NSString*)lat {


CLLocation *myLocation = [[CLLocation alloc] initWithLatitude:[lat doubleValue] longitude:[lon doubleValue]];


[geocoder reverseGeocodeLocation:myLocation
               completionHandler:^(NSArray *placemarks, NSError *error) {
                   NSLog(@"reverseGeocodeLocation:completionHandler: Completion Handler called!");

                   if (error){
                       NSLog(@"Geocode failed with error: %@", error);
                       return;
                   }

                   if(placemarks && placemarks.count > 0)
                   {
                       //do something
                       CLPlacemark *topResult = [placemarks objectAtIndex:0];
                       NSString *addressTxt = [NSString stringWithFormat:@"%@, %@ %@,%@ %@", [topResult country],
                                               [topResult subThoroughfare],[topResult thoroughfare],
                                               [topResult locality], [topResult administrativeArea]];
                       NSLog(@"%@",addressTxt);

                       NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
                       [formatter setDateFormat:@"yyyy-MM-dd"];

                       //Optionally for time zone converstions
                       [formatter setTimeZone:[NSTimeZone timeZoneWithName:@"..."]];


                       [DataOperations saveRecord:[topResult country] time:time];

                   }
               }];

}

I need to collect output data from these calls.

Any help will appreciated.

  • 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-06-12T15:11:20+00:00Added an answer on June 12, 2026 at 3:11 pm

    Give your object a property, BOOL dunloadin.

    Then, in the completion block, set self.dunloadin to YES.

    Finally, your loop should look something like this:

    for (int i=0; i<10; i++)
    {
        self.dunloadin = NO;
        [self convertToCountries:…];
    
        while (!self.dunloadin)
        {
            [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
        }
    }
    

    However, you might want to consider designing your app differently so that kludges like this aren’t required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that spring can manage your sessions for you, if configured like so:
i want know how i can manage multiple twitter account on iOS in my
I would like to know if there is an existent framework which can manage
I can't manage to figure out why I get an error for the following
How can i manage user permission? i need a fast method to manage users
how can i manage communication with the database in node.js? is there any module
I'm trying to set image for my UIBarButtonItem and I can't manage to do
I have a ruby hash which looks like {10.1.1.6=>nick, 127.0.0.1=>nick1} But I can't manage
I know that you can use static libraries to manage dependencies for iOS apps.
How can I search for a specific version of a package using the Manage

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.