0

I am writing an app that asks for some data from a web-based form and then displays the returned JSON data. But I can't seem to get a handle on how "fill in" the form and get the data returned. The website developer has made a development form for testing this so I can see how it works. If I go to that website and enter data into the fields and press "Submit", it returns JSON-formatted text and displays it in the web browser's window.

What I need to do is have my app populate those fields with data and submit them to the server. The server returns the JSON data and I capture and process it in my app.

I would appreciate any advice on how to do this. As you may have guessed, I am a very new to iOS development. Thanks in advance.

Bob
  • 559
  • 1
  • 5
  • 18
  • See: http://stackoverflow.com/questions/4526273/what-does-enctype-multipart-form-data-mean – bryanmac Dec 21 '12 at 22:05
  • Also, grab CharlesProxy on the mac or fiddler on windows and capture the form post and response. That should make it clear what your iOS app should send (headers, content, etc...). – bryanmac Dec 21 '12 at 22:06

2 Answers2

2

Firstly, you'll need to know what form data you're going to send in a POST request. If you don't know where to find that, take a look at this.

Consider using AFNetworking to make that POST request with JSON feedback. Here's a good example.

Good luck!

Community
  • 1
  • 1
Bio
  • 505
  • 4
  • 10
1

This walkthrough by Matt Long is particularly good: http://www.cimgf.com/2010/02/12/accessing-the-cloud-from-cocoa-touch/.

Essentially, you just need your fields in the post data to match the fields that are present in the html form. Those fields should be evident by posting the form in chrome and watching the request in the network tab in developer tools.

Joseph Yancey
  • 1,498
  • 1
  • 9
  • 7