发布于 3年前

(IOS)Error Domain=com.alamofire.error.serialization.response Code=-1016 Request

按照网上教程添加@"text/html"设置无效,各种方法都试过

仔细找原因,发现com.alamofire.serialization.response.error.data 有数据存在

最后发现响应头没有content-type,导致失败,

好吧,沟通服务器同事,让他加个响应头content-type,他说加这个很麻烦,麻痹的,操.

自己动手丰衣足食,改AFNetworking源码,AFNetworking/Serialization/AFURLResponseSerialization

找到

if (self.acceptableContentTypes && ![self.acceptableContentTypes

containsObject:[response

MIMEType]])

修改成

if (self.acceptableContentTypes && ![self.acceptableContentTypes

containsObject:[response

MIMEType]] &&[response

MIMEType])

©2020 edoou.com   京ICP备16001874号-3