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

The Archive Base Latest Questions

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

I was using NSURLConnection in a synchronous way before running on a background selector,

  • 0

I was using NSURLConnection in a synchronous way before running on a background selector, so when I moved over to ASIHTTPRequest I did the same with this framework.

So, is it a bad idea to do something like the following?

// From another method
[self performSelectorInBackground:@selector(callDatasource) withObject:nil];


- (NSData *)callDatasource {

    NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init];

    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:someURLthatIamusing];
    [request setTimeOutSeconds:50.0];
    [request startSynchronous];
    NSError *error = [request error];
    NSData *returnedData;
    if (!error) {
        returnedData = [request responseData];
    } else {
        // do something with error

    }

    [self performSelectorOnMainThread:@selector(done) withObject:nil waitUntilDone:NO];

    [apool release];

    return returnedData;

}//end

What would be the advantage to use the ASIHTTPRequest and asynchronous methods along with the delegate methods?

  • 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-20T23:49:32+00:00Added an answer on May 20, 2026 at 11:49 pm

    From experience, sometimes odd things can happen when using ASIHTTPRequest synchronous requests off a secondary thread: the download activity icon in the status bar not disappearing upon download completion is one issue I’ve noticed from time to time. I’ve had no major problems in the past, but I use the asynchronous methods now rather than your approach. The ASI asynchronous methods are by the nature of being a widely used library more highly tested than my own implementation could ever be.

    There are a number of advantages with using the asynchronous methods – you mention the delegate methods, but the latest release of ASI actually also supports blocks, which is a great leap forward (dealing with multiple synchronous calls used to be a bit of a pain due to the shared delegate methods (or unique delegates for each asynchronous call). But with blocks you can now get rid of the delegates entirely. I’ve found them to be really useful. Plus if you use multiple contributors it can make readability a lot easier.

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

Sidebar

Related Questions

Using online interfaces to a version control system is a nice way to have
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Looking for a way to retrieve a file size from a web server using
I am pulling down a plist from a URL using an NSURLConnection, which returns
I am using Synchronous request and passing the credentials but I am getting authentication
I'm using NSURLConnection in an iPhone application and the interface seems to slow down
I am using NSURLConnection to download a zipped file from a web service. In
I want to send a large amount of data to a server using NSURLConnection
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using ASP.NET MVC there are situations (such as form submission) that may require a

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.