Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何使用restkit在http头中发送一些数据_Ios_Restkit - Fatal编程技术网

Ios 如何使用restkit在http头中发送一些数据

Ios 如何使用restkit在http头中发送一些数据,ios,restkit,Ios,Restkit,每次我向服务器发出请求时(使用get和post方法),我都需要在http头中发送一些数据。我正在使用restkit中的RKObjectManager。我还需要检查服务器返回的状态(401200404E.t.c)。有人知道解决办法吗 谢谢 如果需要随请求发送自定义头,我建议使用RKClient属性HTTPHeaders,例如: [[[[RKObjectManager sharedManager] client] HTTPHeaders] setValue:myValue

每次我向服务器发出请求时(使用get和post方法),我都需要在http头中发送一些数据。我正在使用restkit中的RKObjectManager。我还需要检查服务器返回的状态(401200404E.t.c)。有人知道解决办法吗


谢谢

如果需要随请求发送自定义头,我建议使用
RKClient
属性
HTTPHeaders
,例如:

[[[[RKObjectManager sharedManager] client] HTTPHeaders] setValue:myValue
                                                          forKey:myHeaderName];

有关状态代码,请参阅版本0.20.0rc1中的my.

。您可以使用以下代码:

[[[RKObjectManager sharedManager] HTTPClient] setDefaultHeader:myHeaderName value:myValue];

更简洁地说:
[[RKObjectManager sharedManager].client setValue:myValue for HttpHeaderField:myHeaderName]这是为所有请求设置头还是仅为一个请求设置头?我正在寻找一种只为单个请求设置头的方法。(心意:)