美文网首页
错误(AFN) Error Domain=com.alamofi

错误(AFN) Error Domain=com.alamofi

作者: 黎希 | 来源:发表于2017-12-27 14:18 被阅读20次

    在写一个网络请求的静态文件时,发现postman可以正常请求数据,而使用AFN时却始终错误;
    错误信息:Error Domain=com.alamofire.error.serialization.response Code=-1016
    经过在网上寻找相关资料发现是AFURLResponseSerialization.m类中解析格式不全导致问题出现;

    那么进入到AFURLResponseSerialization.m搜索[NSSet setWithObjects]字段,将

    [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];
    

    修改为

    [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
    

    问题解决。

    相关文章

      网友评论

          本文标题:错误(AFN) Error Domain=com.alamofi

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