Can't send parameter through alamofire to webservice

前端 未结 1 1499
小蘑菇
小蘑菇 2020-12-22 06:12

I want to send parameter through Alamofire to webservice. I have checked the webservice and it is working properly but it is not accepting parameter just getting response of

相关标签:
1条回答
  • 2020-12-22 06:41

    Issue

    Well based from the Alamofire docs if you don't specify HTTPMethod:

    The Alamofire.request method parameter defaults to .get.

    So judging on that, I think the request being sent there is .get, thus it has no parameters attached to it.

    Solution

    Change your code to:

    Alamofire.request("http://www.webservice.pixcel.com/esp.php", method: .post, parameters: parameters).responseJSON(completionHandler: { (response) in
        print(response)
        print(response.result)
    })
    
    0 讨论(0)
提交回复
热议问题