Domanda

I've been looking for differences between both (Usually for simple request using HTTP/HTTPS) but I couldn't find anything. Is there any difference? I'm asking it because when I need, I just use NSURLConnection and I have seen a lot of people recommending to use AFNetworking (based on CFNetwork).

Regards!

È stato utile?

Soluzione

CFNetwork is a lower-level C class that is basically wrapped by the NSURLConnection class at a high-level of abstraction. You're right to use NSURLConnection. The reason people recommend frameworks like AFNetworking is because they do more than NSURLConnection in less lines of code.

Here is a comparison of AFNetworking, ASIHTTPRequest, and NSURLRequest: ASIHTTPRequest vs AFNetworking vs NSUrlRequest

My favorite networking framework for Objetive-C is actually MKNetworkKit: https://github.com/MugunthKumar/MKNetworkKit

Which is also just a nice abstraction but it allows one to handle connections using success and failure blocks very efficiently.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top