AFNetworking 2.0如何在POST请求的查询字符串中放置一些参数 [英] AFNetworking 2.0 how to put some parameters in the query string of a POST request

查看:99
本文介绍了AFNetworking 2.0如何在POST请求的查询字符串中放置一些参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要调用ws将图像发送到服务器。
谁制作了Web服务器,所以决定应通过URL而不是正文发送会话令牌。

查询应类似于: http://api.service.com/imageupload.php?token=434353435 并且在正文中应该有带有参数的图像。

当我使用 -POST 方法时,会话管理器会将所有参数放入主体中。

有没有办法对请求序列化程序说一些参数放入查询字符串中,而其他参数放入正文中?还是我需要对其进行子类化?

I need to call a ws to send an image to a server.
Who mades the webserver, decided that the session token should be sent trough the URL and not in the body.
The query should look like: http://api.service.com/imageupload.php?token=434353435 and in the body there should be the image with its parameter.
The session manager when I use the -POST methods puts all the parameter inside the body.
Is there a way to say to the request serializer to put some parameters in the query string and others in the body? or do I need to subclass it?

推荐答案

这可以像这样

NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:[@"Google.com" stringByAppendingString:AFQueryStringFromParametersWithEncoding(parameters, NSUTF8StringEncoding)]]] ;

参数是字典

这篇关于AFNetworking 2.0如何在POST请求的查询字符串中放置一些参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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