What are differences between NSURLConnection and ASI-HTTP-Request?

Forrest picture Forrest · Jan 5, 2011 · Viewed 7.4k times · Source

Some people strongly prefer asihttprequest ASIHTTPRequest vs NSURLConnection

Reasons can be listed (not full)

  • a lot of extra features,such as supporting cache,http proxy etc
  • also based on CFNetwork , coming from ImageClient

But also there are a lot of bugs. NSURLConnection and NSHttpConnection are from iOS SDK, maybe have fewer bugs.

From ASIHTTPRequest vs NSURLConnection we can see that asihttprequest does not have better performance than nsurlconnection.

A very good paper Accessing The Cloud From Cocoa Touch

So question here is what differences do you think more ?

And what is your consideration to choose ?

Answer

JosephH picture JosephH · Jan 5, 2011

Your link is comparing an very old version of ASIHTTPRequest - http://allseeing-i.com/ASIHTTPRequest-1.5 has more recent stats.

I'm finding it difficult to say much without repeating much of what I already said on ASIHTTPRequest vs NSURLConnection.

I've seen bugs in both NSURLConnection and ASIHTTPRequest; the advantage of ASIHTTPRequest was that I could fix the bugs in it! (Ben is good at merging in fixes to the mainline, and also very good at fixing bugs reported to him - though I have yet to take advantage of the latter :-) ).

Depending on your app, you may also have to write a lot of code on top of NSURLConnection if you decide to use it (eg. if you need caching), going through the full design/code/test/debug cycle - or you can use ASIHTTPRequest, which has a built in caching layer that's already been tested & debugged.

I think I'd look at the question a different way: If you use ASIHTTPRequest, you have an awful lot of flexibility and power available to you - is there any good reason to build an app using NSURLConnection?