Thursday, 17 December 2015

JSON parsing with AFNetworking 3.0 in iOS .

In this tutorial , i will tell you about AFNetworking in iOS . AFNetworking is used widely in iOS for sending and retrieving data from web server in the form of JSON.

JSON stands for JAVA SCRIPT OBJECT NOTATION.

For using AFNETWORKING in your project :

Step 1 : Search AFNetworking in github and install the AFNetworking in your project through cocoa pods .

  1.  Go to terminal .
  2.  Open your folder where you have created your project by simply writing cd location of your project. e.g.: cd /Users/SaurabhPc/Desktop/Saurabh 
  3.  Write pod init
  4. After that write open -a Xcode Podfile in the terminal . This command will open projects pod file .
  5. Add the following command to add AFNewtorking pod to the project

pod 'AFNetworking', '~> 3.0'

    6.  write pod install to install the pod

After few minutes the pod will be added to your project

Step 2 : Open your project using workspace.

  1. Import AFNetworking.h in your project.
  2. For hitting a web service , find some dummy url which contains JSON eg. http://ip.jsontest.com/
  3. Now add the code to your viewDidLoad



Thank you :)

5 comments:

  1. Is there any tutorial login with afNetworking 3.0?

    thank you

    ReplyDelete
    Replies
    1. Hi emre

      Yes , you can follow my other tutorial for send parameters

      http://codeobjectivec.blogspot.in/2016/04/afnetworking-30-with-post-parameters.html

      I hope it will help .

      Thanks .

      Delete
  2. So finally after so much R&D finally got a Very simple and helpful blog.
    Thanks.

    ReplyDelete
  3. how to sent form data using afnetworking with post method
    in objective c

    ReplyDelete