Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AFNetworking 3.x what is the different between AFHTTPSessionManager and AFURLSessionManager?

I'm about to upgrade AFNetworking from 1.x to 3.x. My question is what is the different between AFHTTPSessionManager and AFURLSessionManager? and when to use each? Which one support both XML and JSON request and response? Thanks

like image 324
Lê Khánh Vinh Avatar asked Jul 27 '16 01:07

Lê Khánh Vinh


1 Answers

You generally use AFHTTPSessionManager if you want to do GET or POST requests that might include preparation of JSON or x-www-formurlencoded requests or parsing of complex responses. You can get away with AFURLSessionManager if you're doing very simple requests for which you don't need any of the additional AFHTTPSessionManager capabilities.

Bottom line, AFHTTPSessionManager is just a subclass of AFURLSessionManager with some richer creation of complex requests and/or parsing of complex responses. Based upon your question (parsing XML and JSON responses), AFHTTPSessionManager is what you want to use.

like image 130
Rob Avatar answered Nov 06 '22 03:11

Rob