AFNetworking 3.x AFHTTPSessionManager和AFURLSessionManager有什么区别? [英] AFNetworking 3.x what is the different between AFHTTPSessionManager and AFURLSessionManager?

查看:383
本文介绍了AFNetworking 3.x AFHTTPSessionManager和AFURLSessionManager有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将将AFNetworking从1.x升级到3.x.我的问题是AFHTTPSessionManagerAFURLSessionManager有什么区别?以及何时使用它们?哪一个同时支持XMLJSON请求和响应?谢谢

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

推荐答案

如果要执行可能包含JSON或x-www-formurlencoded请求准备或解析的GETPOST请求,通常使用AFHTTPSessionManager复杂的响应.如果您要执行非常简单的请求而又不需要任何其他AFHTTPSessionManager功能,则可以使用AFURLSessionManager.

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.

最重要的是,AFHTTPSessionManager只是AFURLSessionManager的子类,具有更丰富的复杂请求创建和/或复杂响应解析功能.根据您的问题(解析XML和JSON响应),AFHTTPSessionManager是您要使用的内容.

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.

这篇关于AFNetworking 3.x AFHTTPSessionManager和AFURLSessionManager有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆