【问题标题】:How to send json post values to a remote server and get the results with iOS 5?如何将 json post 值发送到远程服务器并使用 iOS 5 获取结果?
【发布时间】:2012-04-30 18:11:48
【问题描述】:

我是 IOS 5 的新手,我正在尝试将 json 值发送到远程 php 服务器,这会将结果发回给我。到目前为止,这是我的调度电话:

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 请求。如何发送帖子值?任何帮助将不胜感激,谢谢!

【问题讨论】:

    标签: ios json http post


    【解决方案1】:

    您将不得不求助于 NSURLRequest(或其他请求对象)来执行 POST。 试试这个问题Append data to a POST NSUrlRequest,作为如何发送数据和处理结果的例子。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-28
      • 1970-01-01
      • 2021-08-04
      相关资源
      最近更新 更多