I have been using AFNetworking
for a while, however recently heard opinion NSUrlSession
provides the same functionality as AFNetworking
, so no need to use AFNetworking
. Mostly I'm interested in these features like operations, clients and lazy image down-loader, however, not sure how much additional code I will need to write. Has anybody transitioned from AFNetworking
to NSUrlSession
?
NSURLSession
does not reproduce all of the richness of AFNetworking (notably, the construction of complex HTTP requests and the simplified parsing of the responses). So if you're leveraging these features of AFNetworking, then you might want to stay with AFNetworking.
For the programmer who is currently using NSURLConnection
, though, NSURLSession
offers some nice enhancements. The block-based methods of NSURLSession
are richer than what was provided by NSURLConnection
. Also, NSURLSession
offers background session features that allow requests to continue even if the app isn't running.
For the AFNetworking developer using AFHTTPRequestOperationManager
(which is NSURLConnection
-based), AFNetworking now offers AFHTTPSessionManager
, a very similar interface that leverages NSURLSession
internally (but, curiously, not NSOperationQueue
-based). So, if you want to enjoy some NSURLSession
features with AFNetworking, consider using AFHTTPSessionManager
instead of AFHTTPRequestOperationManager
.
AFNetworking is written on top of NSUrlSession hence no reason to go away from it unless you want to handle all of the implementation details which AFNetworking has already taken care of for you and more to the point it is tested by thousands of users on a daily basis hence is a pretty stable and mature library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With