关于AFHTTPRequestOperationManager跟AFURLSessionManager的区别
2015-12-14 15:46
537 查看
AFNetworking的作者kylef在回答这个问题时如此说道:
AFHTTPRequestOperationManager uses NSOperation’s under the hood, and it uses the older NSURLConnection API from Apple. It works on iOS 6 and onwards. AFURLSessionManager makes use of the newer NSURLSession API, which is only available on iOS 7. I would recommend that you use AFURLSessionManager unless you need anything that you can only do with AFHTTPRequestOperationManager such as using operations or iOS 6 support.
The AFNetworking 2.0 NSHipster article explains all of this, it’s worth checking out.
“NSURLSession is a replacement for NSURLConnection introduced in iOS 7. NSURLConnection isn’t deprecated, and likely won’t be for some time, but NSURLSession is the future of networking in Foundation, and it’s a bright future at that, addressing many of the shortcomings of its predecessor. ”– http://nshipster.com/afnetworking-2/
意思是:AFHTTPRequestOperationManager的底层使用了NSOperation,并且使用的是NSURLConnection,可支持iOS6及更新的系统版本;AFURLSessionManager使用的是更新的NSURLSession,支持iOS7.0以上系统。本人强烈建议使用AFURLSessionManager除非你要使用operations或者需要支持iOS6。
AFNetworking在cocoadocs上的官方文档
关于AFNetworking,另一个作者Mattt Thompson 如此写道
AFNetworking 2.0
AFHTTPRequestOperationManager uses NSOperation’s under the hood, and it uses the older NSURLConnection API from Apple. It works on iOS 6 and onwards. AFURLSessionManager makes use of the newer NSURLSession API, which is only available on iOS 7. I would recommend that you use AFURLSessionManager unless you need anything that you can only do with AFHTTPRequestOperationManager such as using operations or iOS 6 support.
The AFNetworking 2.0 NSHipster article explains all of this, it’s worth checking out.
“NSURLSession is a replacement for NSURLConnection introduced in iOS 7. NSURLConnection isn’t deprecated, and likely won’t be for some time, but NSURLSession is the future of networking in Foundation, and it’s a bright future at that, addressing many of the shortcomings of its predecessor. ”– http://nshipster.com/afnetworking-2/
意思是:AFHTTPRequestOperationManager的底层使用了NSOperation,并且使用的是NSURLConnection,可支持iOS6及更新的系统版本;AFURLSessionManager使用的是更新的NSURLSession,支持iOS7.0以上系统。本人强烈建议使用AFURLSessionManager除非你要使用operations或者需要支持iOS6。
AFNetworking在cocoadocs上的官方文档
关于AFNetworking,另一个作者Mattt Thompson 如此写道
AFNetworking 2.0
相关文章推荐
- android加载网络图片并缓存,对图片进行点击打开相应链接
- shell脚本查看网络配置
- RxJava学习笔记2:基于RxJava+okHttp的Rest Cas登录实现
- 网络应用分析框架
- 2015/12/14 Python网络编程,TCP/IP客户端和服务器初探
- 好用的图片压缩网站https://tinypng.com/
- HttpClient 4.3超时设置
- TCP通信异常断开分析(入门)
- 新博客 http://kunyashaw.com/
- 主流芯片解决方案Ambarella的高清网络摄像机、德州仪器和控制海思
- HTTP Session
- 世界上为什么会有圆?
- 网络之心跳机制
- iOS实用技巧 - AFNetworking安全的使用自签证书访问HTTPS
- JSON解析和网络下载
- JSON解析和网络下载
- 发送http包命令---curl
- 分布式TCP压力测试工具 tcpcopy
- 轻松解读网络术语
- Network学习2_TCP/UDP常见端口