如何将json post值发送到远程服务器并使用iOS 5获取结果? [英] How to send json post values to a remote server and get the results with iOS 5?
本文介绍了如何将json post值发送到远程服务器并使用iOS 5获取结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是IOS 5的新手,我正在尝试将json值发送到远程php服务器,这会将结果发回给我。这是我到目前为止的调度电话:
I'm new to IOS 5 and I'm trying to send json values to a remote php server, which will send me back the results. This is my dispach call so far:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData* data = [NSData dataWithContentsOfURL: http://www.someurl/example.php];
[self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES];
});
我知道这主要是一个GET请求。如何发送帖子值?任何帮助将不胜感激,谢谢!
I know this is mainly a GET request. How can I send post values? Any help would be appreciated, thanks!
推荐答案
您将不得不求助于NSURLRequest(或其他请求对象)来进行POST 。
试试这个问题,将数据附加到POST NSUrlRequest ,如一个如何发送数据和处理结果的例子。
You will have to resort to NSURLRequest (or another request object) to do a POST. Try this question, Append data to a POST NSUrlRequest, as an example of how to send data and handle the result.
这篇关于如何将json post值发送到远程服务器并使用iOS 5获取结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文