RestKit中每个请求的自定义标头 [英] Custom headers per request in RestKit

查看:119
本文介绍了RestKit中每个请求的自定义标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向服务器提交请求,使用RestKit 0.20.3,根据应用程序的某些状态需要不同的标头

I am trying to submit a request to the server,using RestKit 0.20.3 which needs different headers depending on some state of the application

我阅读了这些帖子: 问题1 问题2

i read these posts : question1 question2

他们没有帮助,因为这个api不可用

and they don't help, because this api is not available

如何添加自定义标头到RestKit的url请求?

how do i add custom headers to RestKit's url requests ?

推荐答案

问题2是正确的技术,你只需要使用新的API:

Question 2 is the correct technique, you just need to use the new API:

request = [objectManager requestWithObject: method: path: parameters:];

然后创建操作:

operation = [objectManager objectRequestOperationWithRequest: success: failure:];

然后推送执行:

[objectManager enqueueObjectRequestOperation:];

这篇关于RestKit中每个请求的自定义标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆