![](https://img.haomeiwen.com/i2632519/969b4655c83b6338.png)
![](https://img.haomeiwen.com/i2632519/f7132e7ad6e668cd.png)
![](https://img.haomeiwen.com/i2632519/285fd9f3049ee213.png)
NSURLSession
网络通信类 HTTPSession 都给予 NSURLSession 实现的
AFURLSessionManager《 Session 创建任务的》
AFHTTPSessionManager负责《POST GET HEAD PUT DELETE 等等》请求
序列化
<AFURLRequestSerialization>《请求之前的配置 以表单的形式传参数》
AFHTTPRequestSerializer
AFJSONRequestSerializer
AFPropertyListRequestSerializer
<AFURLResponseSerialization>《请求之后的数据 json xml 等 下面的类就是来做数据处理》
AFHTTPResponseSerializer
AFJSONResponseSerializer《处理返回JSON数据》
AFXMLParserResponseSerializer《处理返回XML数据》
AFXMLDocumentResponseSerializer (苹果系统)《处理返回MAC OX XML数据》
AFPropertyListResponseSerializer《List 不常用》
AFImageResponseSerializer《处理图像》
AFCompoundResponseSerializer《如果返回的数据不确定 这个类会递归找到匹配的数据解析 不常用》
附加功能
AFSecurityPolicy《https 认证的类CA认证(安全) ATS打开 可以用http 不安全链接》
AFNetworkReachabilityManager《网络状态监听 判断与原理:不能判断你的网络到达你的服务器,你只要可以把数据包发出去就认为你有网》
AFHTTPSessionManager
以这个顺序调用 《url-request-session-task-resume》
![](https://img.haomeiwen.com/i2632519/feb1a3e925f3989e.png)
![](https://img.haomeiwen.com/i2632519/53da20d252d2325d.png)
![](https://img.haomeiwen.com/i2632519/ed96c8573a6d3761.png)
![](https://img.haomeiwen.com/i2632519/0e113a049e60b1bb.png)
![](https://img.haomeiwen.com/i2632519/8cee0cf7b7a1a71f.png)
下面看下设置默认证书,无条件信任证书https认证 这里干的事情
![](https://img.haomeiwen.com/i2632519/4937e628964c5cc3.png)
![](https://img.haomeiwen.com/i2632519/3c43d0eeafed58b3.png)
![](https://img.haomeiwen.com/i2632519/17dec9a99777a533.png)
![](https://img.haomeiwen.com/i2632519/faaa5ac49fc6f40a.png)
网友评论