Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences - CFNetwork / NSURLConnection

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!

like image 605
Claudio Avatar asked Sep 13 '13 19:09

Claudio


1 Answers

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.

like image 137
IanStallings Avatar answered Oct 04 '22 06:10

IanStallings