4 ms·
I love this. I found AFNetworking 2.0 to be a bit overcooked (meaning it was far more flexible, but also far less easy to learn to use; nothing against mattt, i
by Greenisus 12y ago
I love this. I found AFNetworking 2.0 to be a bit overcooked (meaning it was far more flexible, but also far less easy to learn to use; nothing against mattt, it has really come a long way towards feeling like an official Cocoa lib, and NSHipster is incredible...it's the first site I check every Monday). My biggest gripe was having to start paying attention to request and response serializers. It was nice to get "free" JSON parsing, but ending up in an error block because of a malformed server response is a pain in the ass. Is it really an error if you get a 200 OK response but the body isn't valid JSON? In my opinion, not really, but anyway, I'm rambling here.
All that said, using NSURLConnection (or NSURLSession) really isn't annoying anymore.
I'm going to give this an honest try.
- matttthompson 12y ago> ...ending up in an error block because of a malformed server response is a pain in the ass. Is it really an error if you get a 200 OK response but the body isn't valid JSON? Yes. Oh goodness, yes it is. Having consistent validation on the networking level means not having sporadic logic scattered throughout models and view controllers. Your server sent invalid JSON (e.g. sending HTML instead)? AFNetworking just saved you from a crash, or some other undefined, dangerous behavior. AFNetworking is pedantic because networking is such a wildcard, in terms of performance, consistency, and security.