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 8980109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:59:58+00:00 2026-06-15T19:59:58+00:00

I am running AFNetworking asynchronously. See code below. I want to run it synchronously

  • 0

I am running AFNetworking asynchronously. See code below.

I want to run it synchronously to do a package download (I need to get the list of services that people will be able to choose from). How can I do this?

Thanks.

 NSMutableURLRequest *apiRequest =
[self multipartFormRequestWithMethod:@"POST"
                                path: pathstr
                          parameters: params
           constructingBodyWithBlock: ^(id <AFMultipartFormData>formData)
           {
               //TODO: attach file if needed
           }];

AFJSONRequestOperation* operation = [[AFJSONRequestOperation alloc] initWithRequest: apiRequest];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
    //success!
    completionBlock(responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    //failure :(

    NSLog(@"%@", error);
    completionBlock([NSDictionary dictionaryWithObject:[error localizedDescription] forKey:@"error"]);
}];

[operation start];
  • 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-15T19:59:59+00:00Added an answer on June 15, 2026 at 7:59 pm

    I want to run it synchronously to do a package download (I need to get the list of services that people will be able to choose from). How can I do this?

    AFNetworking does not support sync operations.

    On the other hand, you almost never want sync operations on your UI thread, because the UI would become unresponsive.

    (I need to get the list of services that people will be able to choose from)

    What you could do is displaying some UI hint that the list of services is being downloaded while the async operation is in progress.

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

Sidebar

Related Questions

Running FxCop on my code, I get this warning: Microsoft.Maintainability : 'FooBar.ctor is coupled
Running the following code, I expect to see the relative forms, so I can
Running the code listoflists = [] list = [] for i in range(0,10): list.append(i)
Running the below code with Fiddler shows that plus signs are getting converted to
Running my script through Devel::NYTProf showed that the following portion of code took up
Running on: mehoggan@mehoggan-laptop:~/Code/svn_playground/C++/timer/timer0$ uname -a Linux mehoggan-laptop 2.6.32-37-generic #81-Ubuntu SMP Fri Dec 2 20:32:42
Running my play framework small app I get the following exception: ... Caused by:
Running the following (slightly pseudo)code produces the following results. Im shocked at how innacurate
Running into a problem where on certain servers we get an error that the
Running OS X Leopard an MacBook Pro from Jan. 2008. I used to run

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.