ASIHTTPRequest与AFNetworking框架 [英] ASIHTTPRequest vs AFNetworking framework

查看:75
本文介绍了ASIHTTPRequest与AFNetworking框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将开发一个iPad应用程序,它有大量的后台线程网络调用。



我想知道哪一个更好? ASIHTTPRequest仍然可以工作但不能维护。然而,很少有消息称AFNetworking框架会产生许多复杂因素。

解决方案

更新(2013年9月)



自从我最初写这个答案以来已经将近两年了,并且已经发生了很多变化。 AFNetworking 即将进入2.0版并且拥有一个蓬勃发展的开发者社区,而 ASIHTTPRequest 几乎已经死亡。此外, AFNetworking 还有许多优秀的帮助程序库和类可用于处理OAuth,Amazon S3等内容。它很受欢迎,上面有几本书。



鉴于此,没有理由继续使用 ASIHTTPRequest 。我的原始答案如下,所以如果您仍然感兴趣请继续阅读 - 请记住,我现在建议毫无疑问不使用 ASIHTTPRequest 并选择更现代化的东西(即 AFNetworking ,但其他选项可用)。



原始答案(2011年12月)



你有多少时间?这是我的想法,虽然作为一个主观问题,我认为没有正确或错误的答案。



我领导一个开发团队,为大型客户提供商业应用程序,我的一些同事总是在寻找可以让事情变得更轻松的新图书馆。目前我猜绝大多数网络都使用 ASIHTTP 。我们大约六个月前看过 AFNetworking ,当时我们决定坚持我们所知道的。 ASI已经存在了一段时间,并且在线提供了更多的文档和有用的建议。它是一个坚实的代码库,并且已经存在很长时间以获得很大的牵引力和尊重。



那说(希望那些不同意我上面所说的所有内容的人会继续阅读!),我想如果你要开始了现在是重新开始其他事情的时候了。甚至ASI的 开发人员也是这么认为的。考虑到iOS 5带来的所有变化,我认为现代积极维护的框架,如 AFNetworking (还有其他选项,如RestKit)是一个不错的选择。 / p>

现在,你说某些人在他们的应用程序中使用AFNetworking时遇到了麻烦。但同样,快速谷歌揭示了许多ASI有问题的人(有效与否)!我认为无论你使用什么框架,某个的人都会遇到麻烦,无论是通过框架的真正错误还是他们自己的限制。



所以考虑到这一切,我想我会潜入AFNetworking,看看你是怎么过的!我的新年决议之一将是迁移到新的网络库,我认为它可能是AFNetworking。



来自作者的评论:



稍微更新:我真的很喜欢使用AFNetworking,而且在很多方面它都要好得多(可能不是正确的词) :'精致',也许)比ASI。也就是说,你不应该期待一个喜欢喜欢的替代品,并且有些事情你可能想要考虑其他选项(亚马逊S3,例如ASI支持开箱即用)。但我一般都非常高兴,并且发现它是一个清晰,文档齐全的库。因此,如果您希望从ASI转移到其他地方,那么AFNetworking真的不会出错......


I am about to develop an application for iPad and it has enormous amount of background thread network calls.

I would like to know which one will be better? ASIHTTPRequest still works but not maintained. However few sources says AFNetworking framework creates lots of complications.

解决方案

Update (September 2013)

It's been nearly two years since I originally wrote this answer, and quite a lot has changed. AFNetworking is about to go into version 2.0 and has a thriving developer community, whereas ASIHTTPRequest is pretty much dead. Additionally, AFNetworking has dozens of great helper libraries and classes available for handling things like OAuth, Amazon S3, and the like. It's so popular that there's several books available on it.

Given this, there's no reason at all to keep using ASIHTTPRequest. My original answer is below, so if you're still interested do read on - just bear in mind I would now recommend without a doubt not using ASIHTTPRequest and going with something more modern (namely, AFNetworking, but other options are available).

Original Answer (December 2011)

How much time have you got? Here's my thoughts, although as a subjective question I don't think there's a right or wrong answer.

I lead a development team that works on commercial apps for sizeable clients, and some of my colleagues are always on the look-out for new libraries that can make things easier. Currently I guess the vast majority of our networking uses ASIHTTP. We took a look at AFNetworking about six months ago, and decided at the time we'd stick with what we know. ASI has been around for a while, and there is far more documentation and helpful advice available online for it. It is a solid codebase, and been around long enough to have gained a lot of traction and respect.

That said (and hopefully people who disagree with everything I've said above will read on!), I think if you're starting afresh now is the time to move on to something else. Even the developer of ASI thinks so. Given all of the changes that have come with iOS 5, I think a modern actively maintained framework like AFNetworking (and there are other options, like RestKit) is a good choice.

Now, you're right to say some people have trouble using AFNetworking in their application. But equally, a quick google reveals many people who had problems with ASI (valid or not)! I think whatever framework you go with, someone somewhere will have had trouble with it, either through something genuine wrong with the framework or their own limitations.

So with all this in mind I think I'd dive in to AFNetworking, and see how you get on! One of my new year resolutions will be to migrate over to a new networking library, and I think it will probably be AFNetworking.

From Author's Comment:

A little update: I've actually really enjoyed using AFNetworking, and in many ways it's considerably better (probably not the right word: 'refined', maybe) than ASI. That said, you shouldn't go into it expecting a 'like for like' replacement, and there are certain things you may want to consider other options for (Amazon S3, which ASI supported out of the box for example). But I'm generally really pleased, and find it a clear, well documented library. So if you're looking to move from ASI to something else, you really can't go wrong with AFNetworking...

这篇关于ASIHTTPRequest与AFNetworking框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆