Swift3 Alamofire.AFError.responseValidationFailed

Swift3 Alamofire.AFError.responseValidationFailed,swift3,alamofire,Swift3,Alamofire,正在获取错误。。。我不知道怎么修请帮帮我 APIError<jsonError>(request: Optional(https://www.abcd.com/mobile_app/cell_action.php/?action=brand_slider_homepage), response: Optional(<NSHTTPURLResponse: 0x60800042bd20> { URL: https://www.abcd.com/cell_app/mobile_

正在获取错误。。。我不知道怎么修请帮帮我

APIError<jsonError>(request: Optional(https://www.abcd.com/mobile_app/cell_action.php/?action=brand_slider_homepage), response: Optional(<NSHTTPURLResponse: 0x60800042bd20> { URL: https://www.abcd.com/cell_app/mobile_action.php/?action=brand_slider_homepage } { status code: 200, headers {
"Access-Control-Allow-Headers" = "Origin, X-Requested-With, Content-Type, Accept";
"Access-Control-Allow-Methods" = "PUT, GET, POST";
"Access-Control-Allow-Origin" = "*";
"Cache-Control" = "max-age=60, private, must-revalidate";
Connection = close;
"Content-Encoding" = gzip;
"Content-Length" = 1630;
"Content-Type" = "text/html";
Date = "Mon, 03 Apr 2017 07:17:43 GMT";
Expires = "Mon, 10 Apr 2017 07:17:43 GMT";
Server = "Apache/2.4.17 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4";
Vary = "Accept-Encoding,User-Agent";
"X-Powered-By" = "PHP/5.5.30";
} }), data: Optional(16487 bytes), error: Optional(Alamofire.AFError.responseValidationFailed(Alamofire.AFError.ResponseValidationFailureReason.unacceptableContentType(acceptableContentTypes: ["application/json"], responseContentType: "text/html"))), errorModel: Optional(abcd.HomeBrandVIewCell.jsonError))
APIRERROR(请求:可选(https://www.abcd.com/mobile_app/cell_action.php/?action=brand_slider_homepage),响应:可选({URL:https://www.abcd.com/cell_app/mobile_action.php/?action=brand_slider_homepage }{状态代码:200,标题{
“访问控制允许标头”=“来源,X请求,内容类型,接受”;
“访问控制允许方法”=“PUT、GET、POST”;
“访问控制允许来源”=“*”;
“缓存控制”=“最大使用年限=60,专用,必须重新验证”;
连接=关闭;
“内容编码”=gzip;
“内容长度”=1630;
“内容类型”=“文本/html”;
日期=“2017年4月3日星期一07:17:43 GMT”;
Expires=“2017年4月10日星期一07:17:43 GMT”;
Server=“Apache/2.4.17(Unix)OpenSSL/1.0.1e-fips mod_bwlimited/1.4”;
Vary=“接受编码,用户代理”;
“X-Powered-By”=“PHP/5.5.30”;
}}),数据:可选(16487字节),错误:可选(Alamofire.AFError.responseValidationFailed(Alamofire.AFError.ResponseValidationFaileureReason.unacceptableContentType(AcceptableContentType:[“application/json”]、responseContentType:“text/html”)),错误模型:可选(abcd.HomeBrandVIewCell.jsonError))
thnx预先

当您设置并期望json时,服务器会发送“text/html”作为响应:

acceptableContentTypes:[“application/json”],responseContentType:“text/html”

然后需要自定义HTTP正文。在GitHub中尝试此链接: