のvarパラメータです:文字列Alamofire SWIFT 3.1郵便サービスコールの応答以下の私のコードは、文字列=
parameters["client_id"] = "trackmykid"
parameters["client_secret"] = "trackmykid"
parameters["grant_type"] = "password"
parameters["roleId"] = "2"
parameters["device_token"] = "12324567"
parameters["os_type"] = "ios"
parameters["username"] = username
parameters["password"] = password
はヘッダを聞かせて:HTTPHeaders = [ "のContent-Type":「アプリケーション/ X- www-form-urlencodedで返します」、 "認可": "基本dHJhY2tteWtpZDp0cmFja215a2lk" ]
var Paramdict = [String: String]()
Paramdict = ["client_id":"trackmykid","client_secret":"trackmykid","grant_type":"password","roleId":"2","device_token":"123456","os_type":"ios", "username":username,"password":password]
Alamofire.request(Baseurl.appending("oauth/token"), method: .post, parameters: Paramdict as? Parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { (response:DataResponse<Any>) in
switch(response.result) {
case .success(_):
if response.result.value != nil{
print(response.result.value ?? NSDictionary())
onSuccess(response.result.value as! [AnyHashable : Any])
}
break
case .failure(_):
print(response.result.error ?? NSString())
onFailure(response.result.error!)
break
}
応答として:
{error = "invalid_request"; "error_description" = "不足している許可タイプ"; }
任意のクエリ私の答えをチェックし、私はあなたに –