在目标C中设置http标头

时间:2014-08-08 18:47:53

标签: objective-c

我想知道如何在Objective C中设置HTTPHEADER。

在PHP中,我的代码如下:

    $headers = array(
            'Sign: '.$sign,
            'Key: '.$key,
            );
     //I send it with curl

    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

我尝试了一些东西,但我无法创建由PHP生成的数组,因此服务器拒绝了我的请求。

有没有人有想法?

1 个答案:

答案 0 :(得分:1)

是的,你可以用

[theRequest setValue:@"value" forHTTPHeaderField:@"Sign"];

similar question