2017-04-03 8 views
0

をAlamofire.AFError.responseValidationFailed ...私はそれを修正する方法がわからない、事前に私にがエラーを取得

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)) 

のthnxを助けてください

答えて

0

Serverはながら対応して "text/htmlの" を送信しますセットとJSONを期待している:

acceptableContentTypes:[ "アプリケーション/ JSON"]、responseContentType: "text/htmlの"

HTTP本体をカスタムする必要があります。 GitHubでこのリンクを試してください: urlrequestconvertible