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 framework
and 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 performance (integration with
NSJSONSerialization
)
- Richness of API (uploading files,http queries)
- Simplicity
- iOS 6 and future iOS 7 integration
I will keep this short to not belabour the point. I have done many iOS apps with both ASIHTTP and AFNetworking.
I now no longer use ASIHTTPRequest for the following reasons:
- It is a dormant project, and nobody is working on it or maintaining it.
- It has not been upgraded to use ARC (Automatic reference counting), so it becomes clear you are embedding legacy code when you have to have compilor switches of -fno-objc-arc to make it build.
- It has not been updated to make use of blocks which brings the development back to somewhat older design patterns.
AFNetworking is a good choice for majority of your criteria, for the following reasons:
- 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.
Hope this helps.
I preferred ASIHTTPRequest over AFNetworking for below reasons.
- If your application does heavy upload operation such as multiple images/videos.
- It does direct streaming of files from your disk, we just have to specify the path of the file and initiate the upload process.
- It does bandwidth throttling.
- It have multiple delegates giving callbacks on the upload progress status.
- Has well managed queues that handle multiple requests.