0
スウィフトを使用してAlamofireにこれを送りたい...Alamofireのパラメータの符号化、辞書内の辞書
curl -X POST https://content.dropboxapi.com/2/files/download
--header "Authorization: Bearer ab-xxx-x-x"
--header "Dropbox-API-Arg: {\"path\": "/acme101/acmeX100/acmeX100.001.png\"}"
しかし、あなたはコードにここを参照してください--header秒を取得する方法を見つけ出すことはできませんか?
JSON: 114 bytes Optional("Error in call to API function \"files/download\": Must provide HTTP header \"Dropbox-API-Arg\" or URL parameter \"arg\".")
が、私は明らかではないそれを正しく提供しますが、異なる組み合わせで数回試みたが、...?
let subPart: NSDictionary = ["path": sourcePath]
let headers:HTTPHeaders = ["Authorization": "Bearer " + token2Save, "Dropbox-API-Arg": String(describing: subPart)]
Alamofire.request("https://content.dropboxapi.com/2/files/download", method: .post, encoding: JSONEncoding.init(options: []), headers: headers).responseData(completionHandler: {feedback in
'print(String(describe:subPart))'、出力は何ですか? –
'JSONEncoding.init(options:[])の代わりに' .JSON'を試してください –
ここに表示されているサブパートの出力は "{ path =" /acme101/acmeX100/acmeX100.001.png "; }です。 Alamofireオプションとしてコンパイルします。注意Swift 3.0とAlamofire 4.0.0を使用しています。 – user3069232