ASIHTTPRequest vs AFNetworking vs NSUrlRequest [英] ASIHTTPRequest vs AFNetworking vs NSUrlRequest
问题描述
过去我使用 ASIHTTPRequest
但现在有 NSURLRequest
。我们现在应该使用 NSURLRequest
吗?是否有任何缺点?
In the past I have use ASIHTTPRequest
but now there is NSURLRequest
. Should we be using the NSURLRequest
now? Are there any disadvantages?
对于现在阅读此内容的人:我最终使用 AFNetworking
,如答案中所述
For people reading this now: I ended up using AFNetworking
as mentioned in the answers
https://github.com/AFNetworking/AFNetworking
谢谢,
推荐答案
NSURLConnection
和 NSURLRequest
是用于管理连接的Cocoa类。在iOS 7中,Apple添加了 NSURLSession
。
NSURLConnection
and NSURLRequest
are the provided Cocoa classes for managing connections. In iOS 7, Apple added NSURLSession
.
但我认为你会找到 AFNetworking
是一个进一步简化网络请求(特别是复杂的HTTP请求)的框架。如果您不想出于任何原因使用第三方框架,可以使用 NSURLConnection
和/或 NSURLSession
直。它只需要更多的编码。
But I think you'll find AFNetworking
to be a framework that further simplifies network requests (notably complex HTTP requests). If you don't want to use third-party frameworks for any reason, you can use NSURLConnection
and/or NSURLSession
directly. It just takes a little more coding.
如果您正在寻找一个好的 ASIHTTPRequest
替代方案, AFNetworking
是一个很棒的候选人。
If you're looking for a good ASIHTTPRequest
alternative, AFNetworking
is a great candidate.
有关 NSURLConnection
和 NSURLSession
的信息,请参阅< a href =https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html> URL加载系统编程指南。
For information on NSURLConnection
and NSURLSession
see the URL Loading System Programming Guide.
这篇关于ASIHTTPRequest vs AFNetworking vs NSUrlRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!