ASIHTTPRequest vs AFNetworking vs NSUrlRequest ASIHTTPRequest vs AFNetworking vs NSUrlRequest ios ios

ASIHTTPRequest vs AFNetworking vs NSUrlRequest


NSURLConnection and NSURLRequest are the provided Cocoa classes for managing connections. In iOS 7, Apple added NSURLSession.

But I think you'll find AFNetworking to be a framework that further simplifies network requests (notably complex HTTP requests). If you don't want to use third-party frameworks for any reason, you can use NSURLConnection and/or NSURLSession directly. It just takes a little more coding.

If you're looking for a good ASIHTTPRequest alternative, AFNetworking is a great candidate.

For information on NSURLConnection and NSURLSession see the URL Loading System Programming Guide.


NSURLRequest has been there since iOS2.0 (see the doc), so it is not precisely new. ASIHTTPRequest has been discontinued, the last update was on 15th May 2011, so you shouldn't use it. AFNetworking is a delightful networking library for iOS and Mac OS X as described by them self, and really makes your live easier, in my case it is the first framework I include in my network required projects.

Which one you should use?, I think this depends on your requirements, with NSURLRequest and NSURLConnection you can do everything, in fact AFNetworking us built on top of NSURLConnection. But how I tell you before, AFNetworking has my upvote.

EDIT post iOS7

If you are targeting iOS7 you should take a look to NSURLSession, check the official documentation, and this tutorial.

EDIT for Swift

Take a look to the Alamofire project for an implementation done in Swift, it is also created by mattt (the main author of AFNetworking).


The asihttprequest is outdated library that doesn't support now for development. Do not use it.

the NSURLRequest is default iOS (cocoa) class to use. I recommend it for very little usage because you will need to write lots of code to handle connection responses.On top of it are build all http libraries.

The AFNetwoking is standart now for http, imho. It uses blocks for callbacks, it supports different types of data json, xml etc. it is well designed and can be easily subclassed. it is best.