问题描述
我开始开发一个大型的基于网络的iOS项目。我感兴趣的是我应该选择什么框架。
我看到很多关于它的帖子:
等等,但他们都老了。我也读过这篇文章: ; 在过去几个星期给出了很多想法后,我决定我将来不再继续使用ASIHTTPRequest。
它写回了2011年。所以,因为我理解 ASIHTTPRequest
已过时?我在iOS中没有很多经验。所以我感兴趣的是什么是现代状态的事情。什么是更好 - ASIHTTPRequest
或 AFNetworking
?我对下一个标准感兴趣:
I'm in the beginning of developing a large iOS project which is heavily network based. And I'm interested what framework should I choose now.I see a lot of posts on SO about it: ASIHTTPRequest vs AFNetworking frameworkand etc. But they are all old. And I also read this:http://allseeing-i.com/%5Brequest_release%5D; After giving it a lot of thought over the last few weeks, I’ve decided that I’m not going to continue working on ASIHTTPRequest in future.
it was written back in 2011. So as I understood ASIHTTPRequest
is obsolete? I haven't a lot of experience in iOS. So I'm interested what is a modern state of things. What is better - ASIHTTPRequest
or AFNetworking
? I'm interested in the next criteria:
- JSON性能(与 NSJSONSerialization )
- 丰富的API(上传文件,http查询)
- 简单
- iOS 6和未来iOS 7集成
- JSON performance (integration with
NSJSONSerialization
) - Richness of API (uploading files,http queries)
- Simplicity
- iOS 6 and future iOS 7 integration
推荐答案
我会保持这一点,我已经使用ASIHTTP和AFNetworking做了许多iOS应用程序。
I will keep this short to not belabour the point. I have done many iOS apps with both ASIHTTP and AFNetworking.
我现在不再使用ASIHTTPRequest,原因如下:
I now no longer use ASIHTTPRequest for the following reasons:
- 这是一个休眠项目,没有人在处理或维护它。
- 它尚未升级到使用ARC(自动引用计数) ,因此很清楚,当您必须具有-fno-objc-arc的编译器开关来进行编译时,您才会嵌入旧代码。
- 尚未更新以使用块
AFNetworking是大多数标准的不错选择,原因如下:
AFNetworking is a good choice for majority of your criteria, for the following reasons:
- AFNetworking不是休眠的,并且正在积极参与。 (如果添加更多文件处理,这是一个接受ASIHTTPRequest的好地方)
- JSON性能 - 它与NSJSONSerialization集成,并为您自动反序列化json REST请求。
- API非常干净,易于使用(使用块,所以你的代码也会更干净)但是,我建议使用其他文件下载和上传,不知道一个好
- 在iOS 6和7上使用它没有问题,刚刚使用它
- AFNetworking is not dormant, and is actively being contributed to. (this is in a good place to take over from ASIHTTPRequest if it added more file handling)
- JSON Performance - it does integrate with NSJSONSerialization and deserialize json REST requests automatically for you.
- API is very clean and easy to use (makes use of blocks, so your code will be cleaner also) But, i would recommend using something else for file downloads and uploads, don't know a good standard solution for this yet.
- Simplicity, yes, very simple.
- No issues with using it for iOS 6 and 7, have just used it recently for a project and it's iOS 7 ready.
希望这有助于。
这篇关于ASIHTTPRequest和AFNetworking在2013年。选择什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!