当前位置: 动力学知识库 > 问答 > 编程问答 >

objective c - Download JSON data from a web form

问题描述:

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.

网友答案:

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.

网友答案:

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!

分享给朋友:
您可能感兴趣的文章:
随机阅读: