My apps…

Space Harvest Begin

All-Seeing Interactive is a tiny web design and software company based in London, UK.

Sunday 9 November 2008

ASIHTTPRequest goes iPhone

It’s been a while since my last update, having been rather busy with my day job. Now that I have a bit of time to myself, I’m going to be doing a bit more work on ASIHTTPRequest.

I’ve just posted a gigantic update to the Github repository, get it while it’s hot:

Or via the magic of Git here:

$ git clone git://

What’s new?

iPhone support

I know lots of people have been using ASIHTTPRequest on iPhone already, but there were quite a few kinks to iron out. Initial support for iPhone is now included, and there’s a sample app in the Xcode project. I haven’t tested all features yet (eg: Authentication + Keychains), so some bits may need more work.

Progress tracking has been re-written for compatibility with iPhone, as UIProgressViews have a different interface for setting progress from NSProgressIndicators. ASIHTTPRequest will automatically figure out which kind of progress indicator you’re trying to update, and manage the details for you.


This new NSOperationQueue subclass manages tracking the progress of multiple requests at once. Using this, you can show the progress of a set of requests using a single NSProgressIndicator (or UIProgressView on iPhone).

Refactoring - ASIFormDataRequest

I originally intended ASIHTTPRequest to be about making it easier to POST data to servers in the same way that multipart/form-data forms in HTML work. However, from the feedback I’ve received, a few people have been using it for sending data in other ways, for example SOAP requests or using REST, and populating the request body themselves.

I decided to split the ASIHTTPRequest class in two. The main ASIHTTPRequest class handles all the basic HTTP stuff - setting up the request, sending and receiving data, handling authentication and cookies. The new ASIFormDataRequest subclass handles multipart form POST requests.

What does this mean for your applications? If you want to manage the request body yourself, simply subclass ASIHTTPRequest and override main. If you want to POST form data and files, use an ASIFormDataRequest instead, and let it build your request body for you.

Memory behaviour

A fair number of memory leaks have been fixed (thanks, Clang Static Analyzer!), and the main loop for a particular request now cleans the autorelease pool every cycle so that a gigantic backlog doesn’t mount up in memory.

Lots more

You can now set the request method (GET / POST / PUT / DELETE) via the requestMethod property. Note that ASIHTTPRequest will override this if you use postData (or fileData with ASIFormDataRequest).

I’ve also added loads more Unit Tests, and fixed a fair number of bugs.

Free publicity for every reader

Finally, a thank you to everyone who has taken the time to write to me about ASIHTTPRequest over the last few months. I would very much like to compile a list of applications that use it to appear on this website. If you are using ASIHTTPRequest in a shipping Mac OS or iPhone app, and wouldn’t be adverse to some free publicity, please drop me an email!

Posted by Ben @ 2:12 PM