Resolved AFNetworking Vs NSURLConnection ?

Discussion in 'iOS Programming' started by Tander, Jul 30, 2013.

  1. Tander, Jul 30, 2013
    Last edited: Jul 30, 2013

    Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #1
    Hi Guys,

    So I am busy following this tutorial:

    http://nscookbook.com/2013/03/ios-p...ulating-a-uitableview-with-data-from-the-web/

    It mentions that the industry standard for parsing JSON/XML data from the web has moved from NSURLConnection (Which I have used before, briefly ) to this AFNetworking code.

    Which requires downloading and setting up a 3rd party guide.


    What I want to know - is this the best way to go ahead with this sort of thing - what about compatibility in newer versions of Xcode and OS X?

    For now I will use this library - but just wondering why move away from NSURLConnection to AFNetworking?
    Easier to maintain code?
     
  2. dantastic macrumors 6502

    dantastic

    Joined:
    Jan 21, 2011
    #2
    AFNetworking just like all other popular libraries to do the same all use NSURLConnection to do the actual 'work'. They just include a bunch of friendly methods so you can easily make requests without having to write a whole lot of boilerplate code yourself.

    If you don't understand what is going on and you're learning you might well be better off writing the request and the delegate yourself. If you're making an actual app you are probably better off relying on something like AFNetworking or MKNetworkKit.

    AFNetworking is there on github, have a read through the code so you can see as well what it does. That should really answer the question for you then.
     
  3. Tander thread starter macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #3
    Great, thanks for the answers.

    I will read up on the library some more and go through the code myself and try to understand it.

    If it makes life easier, then I will keep using it. I know for a fact I need to use this sort of thing in my app as I am pulling data from the web. (I just don't know what data, yet)

    I wrote the NSURLConnection manually a few months ago - right at the start of my learning iOS development and it was a lot to type etc - I don't remember it off hand - so I will go back and look at that too, to see how it differs.
     
  4. Tander thread starter macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #4

Share This Page