What would be the best option for:
URL Request
NSURLConnection
ASIHTTPRequest
AFNetwork
JSON Parsing
NSJSONSerialization
SBJSON
I have picked ASIHTTPRequest+NSJSONSerialization, but I am not quite sure! Any idea(s) or suggestion(s)
Features wise, AFNetworking > ASIHTTPRequest > NSURLConnection. ASIHTTPRequest is not supported anymore. It's a closed project. NSURLConnection is apple-provided so it's barebones. AFNetworking is still an active project and from the talk of my colleagues here in SO, it's getting better.
NSJSONSerialization is Apple-provided and SBJSON is third party again.SBJSON gives your a better/easier interface to convert data objects in either formats (Foundation <--> JSON).
BUT - things majorly depend on what you want to get out of your project and what the requirements are. Each of these projects has it's advantages and disadvantages. You just need to research each of these frameworks and choose the best that suits your project. Also, there are tons of resources here on SO that help you decide what to pick.
Related
In my iOS app, I am trying to get a list of serialized objects from an HTTP server.
Which Apple API should I choose to get the binary from server?
I have read about NSURLSession, NSURLConnection, and others, but not sure which one to choose.
Both will do. NSURLSession is much more powerful tool than NSURLConnection.
If your task is simple - use NSURLConnection. If you need all that fine features of NSURLSession - go for it.
There's a great tutorial on using NSURLSession NSURLSession tutorial. It also states diff between both tools
Also, take a look at AFNetworking framework - makes everything much easier
I became interested in this after reading the list of libraries used by Instagram:http://instagram.com/about/legal/libraries/
"The following sets forth attribution notices for third party software that may be contained in portions of the Instagram product. We thank the open source community for all of their contributions."
And they list both AFNetworking and ASIHTTPRequest. I don't understand why. Is there some sort of back compatibility or what? As far as I know ASIHTTPRequest is dead for now.
Can someone explain me possible reasons for this? Thanks
As Paul.s pointed in his comment the main reason is legacy code. First version of Instagram app was published in the App Store in 2010. And developing of AFNetworking was started in 2011. So in 2010 the de facto standard for networking code was ASIHTTPRequest and I think Instagram developers choose it. But Instagram is a fastly developed mainstream application with hundred of millions users (2014) which must continuosly update. ASIHTTPRequest is an outdated library for now and AFNetworking is the best library for network bound applications which is a successor of asihttp. I think Instagram developers switched to it fully now and just pointed ASIHTTPRequest in their libraries list because earlier they used it heavily.
AFNetworking is being actively developed by Mattt Thompson. It is state of the art.
Here is the author's note on ASIHTTPRequest:
"Please note that I am no longer working on this library - you may want to consider using something else for new projects. :)"
ASIHTTPRequest uses the CFNetwork framework, which is a lower-level framework than the NSURLConnection framework used by AFNetworking.
This provides a few advantages. One example is the ability to specify an HTTP proxy like so:
NSURL *url = [NSURL URLWithString:#"http://allseeing-i.com/ignore"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setProxyHost:#"192.168.0.1"];
[request setProxyPort:3128];
It is impossible to specify an HTTP proxy with AFNetworking, because NSURLRequest doesn't support it.
I won't rehash all of the differences, since most of the benefits are outlined in their documentation.
As Zaph notes, ASIHTTPRequest has not been updated in ages. AFNetworking is vastly superior in most respects.
Summary: if you're not sure, use AFNetworking.
I would like to know if there is any way (or fork project of RESTKit) that allows to do streaming of the HTTP response body instead of loading everything in memory like RESTKit is currently doing.
Thanks a lot
Looking over the code, it doesn't look like that RestKit suports streaming of the response body.
It looks like you might need another solution. I hear AFNetworking is really good for doing the networking part of it (I haven't used it yet myself). And I've used "YAJL" to do a streaming JSON parser. Apparently AFNetworking can hook into YAJL... not sure how this would work, but you might look into this.
I'm building an application that needs to communicate with a REST service.
The application is using ARC so ASIHTTPRequest is NOT an option.
Also RESTKit horribly failed when we tried to use it.
How should we tackle sending the http request? (preferably asynchronicly) and 'storing' the data to be parsed by an XML parser (I don't really need help with that, just need to know how to feed it the data).
You don't need to use ARC everywhere, check out this question and answer, you could just disable ARC for the third party libraries.
Disable Automatic Reference Counting for Some Files
You can use AFNetworking its a very good Lib for REST communication protocol. And you can just disable ARC for AFNetworking as well.
I would like to understand advantages of using RESTKIT/ASIHTTPREquest libraries over the traditional NSURLconnection for calling RESTFUL/SOAP webservices. I had used both type of webservices(RESTKIT/SOAP) in my project with nsurlconnection and I am successful...
Hence anyone pls help me to understand the benifits of going to RESKIT/ASIhttprequest...
RestKit has good integration with CoreData. ASIHTTP uses blocks which can be nice for firing one off requests. The more I use different network libraries, the more I think there is no one-solution to this problem yet.
Be careful with ASIHTTPRequest. Yeah, it is great and all but it was last updated May 2011 and the author has stopped development on it. See http://allseeing-i.com/%5Brequest_release%5D;