ios使用HTTP POST上传图像和文本 - ios Upload Image and Text using HTTP POST

问题:

Thanks for reading. 谢谢阅读。

I am new to iOS and I am trying to upload an Image and a text using multi-part form encoding in iOS. 我是iOS的新手,我正在尝试在iOS中使用multi-part form encoding上传图像和文本。

The curl equivalent is something like this: curl -F "param1=value1" -F "[email protected]" " http://some.ip.address:5000/upload " 等效的curl是这样的: curl -F "param1=value1" -F "[email protected]" " http://some.ip.address:5000/upload "

The curl command above returns the expected correct response in JSON. 上面的curl命令以JSON.返回预期的正确响应JSON.

Problem: I keep getting a HTTP 400 request which means I am doing something wrong while composing the HTTP POST Body. 问题:我不断收到HTTP 400请求,这意味着在编写HTTP POST正文时我做错了什么。

What I Did: For some reference, I tried Flickr API iOS app "POST size too large!" 我所做的事情:为了提供一些参考,我尝试了Flickr API iOS应用“ POST size too too!”。 and Objective C: How to upload image and text using HTTP POST? 目标C:如何使用HTTP POST上传图像和文本? . But, I keep getting a HTTP 400. 但是,我一直收到HTTP 400。

I tried the ASIHttpRequest but had a different problem there (the callback never got called). 我尝试了ASIHttpRequest但那里遇到了另一个问题(从未调用过回调)。 But, I didn't investigate further on that since I've heard the developer has stopped supporting the library: http://allseeing-i.com/[request_release] ; 但是,由于我听说开发人员已停止支持该库,因此我对此不作进一步调查: http : //allseeing-i.com/[request_release] ;

Could someone please help me out? 有人可以帮我吗?


解决方案:

参考: https://stackoom.com/en/question/Zw6T
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章