2

I'm in the beginning of developing a large iOS project which is heavily network based. And I'm interested what framework should I choose now. I see a lot of posts on SO about it: ASIHTTPRequest vs AFNetworking framework and etc. But they are all old. And I also read this:http://allseeing-i.com/%5Brequest_release%5D; After giving it a lot of thought over the last few weeks, I’ve decided that I’m not going to continue working on ASIHTTPRequest in future. it was written back in 2011. So as I understood ASIHTTPRequest is obsolete? I haven't a lot of experience in iOS. So I'm interested what is a modern state of things. What is better - ASIHTTPRequest or AFNetworking? I'm interested in the next criteria:

  1. JSON performance (integration with NSJSONSerialization)
  2. Richness of API (uploading files,http queries)
  3. Simplicity
  4. iOS 6 and future iOS 7 integration
Community
  • 1
  • 1
MainstreamDeveloper00
  • 8,436
  • 15
  • 56
  • 102
  • 1
    AFNetworking is the standard these days. – Dan Fairaizl Sep 03 '13 at 15:16
  • 2
    @DanFairaizl "Standard" is a strong appellation. I don't think it's appropriate. "Viable option" would fit much better. There are a couple of other _viable_ Open Source network libraries available, and major companies - and very likely much smaller one, too - do implement their own. – CouchDeveloper Sep 03 '13 at 16:45
  • @CouchDeveloper, I know its strong to say that but there are just too many projects and developers that use the library these days. You just don't see the alternatives that often, hence AFNetworking is kind of the "standard" networking library for iOS. Just my opinion maybe... – Dan Fairaizl Sep 03 '13 at 17:30

2 Answers2

4

I will keep this short to not belabour the point. I have done many iOS apps with both ASIHTTP and AFNetworking.

I now no longer use ASIHTTPRequest for the following reasons:

  • It is a dormant project, and nobody is working on it or maintaining it.
  • It has not been upgraded to use ARC (Automatic reference counting), so it becomes clear you are embedding legacy code when you have to have compilor switches of -fno-objc-arc to make it build.
  • It has not been updated to make use of blocks which brings the development back to somewhat older design patterns.

AFNetworking is a good choice for majority of your criteria, for the following reasons:

  • AFNetworking is not dormant, and is actively being contributed to. (this is in a good place to take over from ASIHTTPRequest if it added more file handling)
  • JSON Performance - it does integrate with NSJSONSerialization and deserialize json REST requests automatically for you.
  • API is very clean and easy to use (makes use of blocks, so your code will be cleaner also) But, i would recommend using something else for file downloads and uploads, don't know a good standard solution for this yet.
  • Simplicity, yes, very simple.
  • No issues with using it for iOS 6 and 7, have just used it recently for a project and it's iOS 7 ready.

Hope this helps.

karlsburg
  • 185
  • 1
  • 10
  • Your points are not compelling - probably, because I do know the libraries and because your points are basically opinion based. And I have a different opinion - about "simplicity", code quality, "JSON" (which is no argument at all - its JSON, not networking) ;) – CouchDeveloper Sep 03 '13 at 16:51
  • Just answering the question, if you read again, clearly asks "JSON performance (integration with NSJSONSerialization)" which AFNetworking does. Basically, ASI wins on richness of API, but AF wins in every other criteria the poster mentions. in my opinion. – karlsburg Sep 04 '13 at 08:41
0

I preferred ASIHTTPRequest over AFNetworking for below reasons.

  • If your application does heavy upload operation such as multiple images/videos.
  • It does direct streaming of files from your disk, we just have to specify the path of the file and initiate the upload process.
  • It does bandwidth throttling.
  • It have multiple delegates giving callbacks on the upload progress status.
  • Has well managed queues that handle multiple requests.
thatzprem
  • 4,697
  • 1
  • 33
  • 41