ASIHTTPRequest vs NSURLConnection

跟風遠走 提交于 2019-12-01 00:40:13

问题


Just wondering which is faster in terms of performance and usability? Or if there's anything better out there?


回答1:


There's some performance information relating to an old version here:

http://allseeing-i.com/ASIHTTPRequest-1.5

It's pretty comparable. I'm not sure if there are any figures for more recent versions.

Note that the most recent ASIHTTPRequest has built in support for caching (which NSURLConnection doesn't) - if you enable that and it's applicable for your use it gets you a major speedup.

ASIHTTPRequest also does a lot of things for you for free; it can transparently handle HTTP Proxy authentication if you want it to, for example.

I pick ASIHTTPRequest over NSURLConnection all the time: for me the caching was the real major advantage, but everything else is certainly nice to have.

If you do decide to use ASIHTTPRequest, do use the latest git master, not the v1.7 release - the latter has some bugs that cause crashing when cancelling requests and a few other issues which are fixed in master.




回答2:


ASIHTTPRequest is just so much better than NSURLConnection it's ridiculous. It's more powerful AND simpler. I recommend it pretty much every time I see a question here related to NSURLConnection.

I don't know of any other http client library. I'm not religious about ASIHTTPRequest--if a better tool came along, I'd use it. But ASI has SO nailed it, it's hard to think of anybody else reinventing that particular wheel.

EDIT Feb 2012: As of a few months ago, ASIHTTPRequest is deprecated and its author recommends using something else. AFNetworking seems a popular choice, though I haven't used it personally.

I mention this here because this question and answer remain popular, and it seems people don't know about this change.



来源:https://stackoverflow.com/questions/4035451/asihttprequest-vs-nsurlconnection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!