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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章