问题
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?
回答1:
This can be done like this
NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:[@"Google.com" stringByAppendingString:AFQueryStringFromParametersWithEncoding(parameters, NSUTF8StringEncoding)]]] ;
Where parameters is a dictionary
来源:https://stackoverflow.com/questions/24052480/afnetworking-2-0-how-to-put-some-parameters-in-the-query-string-of-a-post-reques