美文网首页
(IOS)Error Domain=com.alamofire.

(IOS)Error Domain=com.alamofire.

作者: rightmost | 来源:发表于2018-12-29 16:57 被阅读0次

按照网上教程添加@"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])

相关文章

网友评论

      本文标题:(IOS)Error Domain=com.alamofire.

      本文链接:https://www.haomeiwen.com/subject/ckdplqtx.html