[Swift,Alamofire]:responseValidationFailed,错误代码为400

[Swift,Alamofire]:responseValidationFailed,错误代码为400,第1张

概述我的问题基本上在标题中.我试图运行的代码就在下面. VVV let unfollow = "https://api.instagram.com/v1/users/\(userID)/relationship?access_token=\(access_token)&action=unfollow" Alamofire.request(unfollow, method: .post).va 我的问题基本上在标题中.我试图运行的代码就在下面. VVV

let unfollow = "https://API.instagram.com/v1/users/\(userID)/relationship?access_token=\(access_token)&action=unfollow"    Alamofire.request(unfollow,method: .post).valIDate().responseJsON(completionHandler: {        response in        switch response.result {        case .success(let value):            let data = JsON(value)["data"]            print(data["outgoing_status"].stringValue)        case .failure(let error):            print(error)        }    })

我收到的确切控制台错误是:responseValIDationFailed(Alamofire.AFError.ResponseValIDationFailureReason.unacceptableStatusCode(400))

我顺便使用Instagram API,但我认为这不一定与问题有关.

任何帮助非常感谢.

解决方法 错误日志responseValIDationFailed(Alamofire.AFError.ResponseValIDationFailureReason.unacceptableStatusCode(400))清楚地表明您收到400错误.这在 W3.org中解释为

400 Bad Request:
The request Could not be understood by the server due to malformed Syntax. The clIEnt SHOulD NOT repeat the request without modifications.

因此,如果正确,您需要请求URL请求URL.

此外,您正在使用请求的valIDate()方法,该方法应该获得响应状态代码200 … 299,但您将获得400作为响应代码.这就是为什么它在错误日志中被提及为不可接受的StatusCode(400).

Seel this也.

总结

以上是内存溢出为你收集整理的[Swift,Alamofire]:responseValidationFailed,错误代码为400全部内容,希望文章能够帮你解决[Swift,Alamofire]:responseValidationFailed,错误代码为400所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1010215.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存