关于AFHTTPRequestOperationManager跟AFURLSessionManager的区别

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。


原文地址:http://blog.csdn.net/u011303816/article/details/50295699

你可能感兴趣的:(iOS,Tips)