Should we consider transitioning from AFNetworking to NSUrlSession? [closed] - ios

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have been using AFNetworking for a while, however recently heard opinion NSUrlSession provides the same functionality as AFNetworking, so no need to use AFNetworking. Mostly I'm interested in these features like operations, clients and lazy image down-loader, however, not sure how much additional code I will need to write. Has anybody transitioned from AFNetworking to NSUrlSession?

NSURLSession does not reproduce all of the richness of AFNetworking (notably, the construction of complex HTTP requests and the simplified parsing of the responses). So if you're leveraging these features of AFNetworking, then you might want to stay with AFNetworking.
For the programmer who is currently using NSURLConnection, though, NSURLSession offers some nice enhancements. The block-based methods of NSURLSession are richer than what was provided by NSURLConnection. Also, NSURLSession offers background session features that allow requests to continue even if the app isn't running.
For the AFNetworking developer using AFHTTPRequestOperationManager (which is NSURLConnection-based), AFNetworking now offers AFHTTPSessionManager, a very similar interface that leverages NSURLSession internally (but, curiously, not NSOperationQueue-based). So, if you want to enjoy some NSURLSession features with AFNetworking, consider using AFHTTPSessionManager instead of AFHTTPRequestOperationManager.

AFNetworking is written on top of NSUrlSession hence no reason to go away from it unless you want to handle all of the implementation details which AFNetworking has already taken care of for you and more to the point it is tested by thousands of users on a daily basis hence is a pretty stable and mature library.

I don't use it as I know the inner workings of the native NSUrlConnection and NSUrlSession, but for most people AFNetworking 2.X is much easier to work with. I wasn't a fan of AFNetworking 1.X which is why I got deeply into doing it myself before 2.X was available.

Related

which is easy to use Afnetworking/Nsurlsession/Alamofire [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I want to make rest api call. I m confused to use Afnetworking or NSurlsession or alamofire with SWIFT 3.0. Can anyone suggest me to use which one.
NSURLSession is newer than NSURLConnection, if you are using swift language then you can use your own custom methods by using NSURLSession or you can use Alamofire.
The NSURLConnection used in AFNetworking frameworks, If you are using objective - c then you can use it, that means not that you cannot use NSURLSession.
NSURLSession launch after iOS 7.0 or 8.0. It is more efficient that NSURLConnection.
At last,
If you want to make your own custom API framework then you can use NSURLSession(for swift)(I also used this).
If you don't required the custom framework then use Alamofire Framework.
For more details you can refer this link:
What are the difference among NSURLConnection, NSURLSession and AFNetworking?
For Swift 3.0 Alamofire is best because it is well Optimized and also reusable and it has also many Build in features.
If You are using Objective- C then you can use AFNetworking.
AFNetworking and Alamofire are from same Developers but in Different Languages.

AFNetworking Custom API Manager [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
For a new app I am designing I want to implement a Request Manager Class (swift) that will handle all the calls to the backend.
Which is the right way to do it? Class Methods or a Singleton and can you please provide me with a pattern or some sample code for me to get started?
Thank you in advance
First of all use Alamofire instead of AFNetworking. Alamofire was made by the same team as AFNetworking, but it's written in pure Swift.
Singleton pattern is a good choice for APIClient. My approach is to make generic wrapper on Alamofire which handles requests with unified error handling and completions, takes care of authentication headers and stuff.
Next step is to extend generic wrapper (i.e by subclassing) to handle application's domain-specific behavior -> all calls that connects to API goes here.
Big plus of this approach is fact that you can reuse this generic wrapper in another app.
Try Alamofire (AFNetworking for swift)
Alamofire.request(.POST, "http:/www.abc.com" , parameters: ["consumer_key": "Og5pRGI2V"]).responseJSON { response in
print(response)
}

JSONModel vs github Mantle Frameworks [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am building an application that requires a lot of JSON data handling. After going over different frameworks, I am down to JSONModel (https://github.com/icanzilb/JSONModel) and github Mantle (https://github.com/github/Mantle) due to their rich feature set and ease of use.
They are both pretty much similar in terms of functionality like data transformation, archiving, copying, automatic and custom key mapping etc. However, JSONModel has some extra out-of-the-box mapping options and built-in model cascading support and Mantle is relatively more popular and obviously github support behind it.
For me performance and ease of use are important, so I was just wondering if anyone out there has real experience using them both and can share that, mostly in terms of performance and ease of use please.
I myself am leaning towards JSONModel due a lot of built-in key mapping options and model cascading but not sure about how is it going to perform with large sets of data.
EDIT (04/28/2015):
I ended up using Github Mantle since that blended well with my application architecture, plus it has more modular design where you can plug in your own property formatters, core data support, nested models, and what not.
Have been using for close to 2 years and never came across a situation where it did not work for me, no kidding! It plays nice with AFNetworking or Alamofire frameworks, works with Swift. I tried to look for alternatives when Swift support was still little patchy, man I could not find anything even remotely awesome.

Library / Framework to manage network call in iOS app [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I try to develop an iOS app which need a lot of network calls...
I see that there is few iOS classes provide in the SDK.
Before to start I would like to know if there are any libraries or framework which stand out of the crowd? Or can you just recommend me the most used?
I've made some research on internet and I found two frameworks MKNetworkKit and ASIHTTPRequest. Anybody know them? Are they efficient?
Thank you.
Use AFNetworking.
However ASIHTTPRequest was also one of the best Framework to manage Network Call but now it's not that much in use.
Even the Developers of the ASIHTTPRequest says :
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.
AFNetworking is more refined than ASI. Supportive Question.
I recommend you use ASIHTTPRequest.
REASON:
1.simple reliable and functional.
2.easy to handle post files (ASIFormDataRequest)
3.process provided
Docs

Framework for a networked iOS app? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm trying to build a basic social iOS app in the new iOS 6 beta as a proof-of-concept project to improve my iOS development skills. In essence I want to allow users to generate an account, store some info in the cloud, and then be able to pull their info (and that of their friends) into the device. I already have a front end roughed in on the device but I now need to start the networking component and am looking for suggestions for any libraries, frameworks, tutorials and/or guidelines to use.
I was thinking of building the server end with node.js and mongodb as I already have a RESTful API built on them which I can adapt to this task. Is this the best way to accomplish such an app? I'm open to any suggestions.
A couple more networking library suggestions:
1) AFNetworking - https://github.com/afnetworking/afnetworking . This is widely used (more so now that ASIHttpRequest has stopped development). It is modern and block-based. However, it is not ARC yet.
2) MKNetworkKit - https://github.com/MugunthKumar/MKNetworkKit . Modern and ARC based.
I switched all my apps from ASIHttpRequest to AFNetworking and highly recommend it.
All the frameworks mentioned so far (ASIHttpRequest, RESTKit, AFNetworking, MKNetworkKit) will talk to a node.js/restful API backend just fine.
The most common and popular libraries to handle network connections are ASIHTTPRequest: http://allseeing-i.com/ASIHTTPRequest/ and RESTKit: http://restkit.org . I am using RESTKit right now as a component of the Salesforce library. I used ASIHTTPRequest in the past and found it to be a very good library. I haven't used it in a while but i highly recommend it.
Edit: I would also reccomend CocoaRestClient to test your APIs.

Resources