带有 -u 的 Alamofire

我需要在 Alamofire 中提出这个请求。

curl https://api.omise.co/charges \
  -u $OMISE_SECRET_KEY: \
  -d "amount=100000" \
  -d "currency=thb" \
  -d "card=tokn_test_5g5mep9yrko3vx2f0hx"

我想应该是这样的

let url = "https://api.omise.co/charges"
let parameters: [String: Any] = ["amount": 100000,"currency": "thb","card": token]
AF.request(url,method: .post,parameters: parameters,encoding: JSONEncoding.default).response { response in
    switch response.result {
        case .success( _):
            let data = responseJSON.result.value!
            print(data)
        case .failure(let error):
            print(error.localizedDescription)

     }
}

我如何提出请求?

我不知道如何处理 -u $ OMISE_SECRET_KEY:

siyuan12345 回答:带有 -u 的 Alamofire

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/84409.html

大家都在问