zoukankan      html  css  js  c++  java
  • iOS AFNetworking “Request failed: unacceptable content-type: text/html”问题

    使用AFNetworking出现报错:

    error=Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo=0x7fdfd8729680 {com.alamofire.serialization.response.error.response= { URL: http://172.16.1.31:7001/itom/getwork } { status code: 200, headers {

        "Cache-Control" = "no-cache";

        "Content-Type" = "text/html;charset=UTF-8";

        Date = "Mon, 24 Nov 2014 03:13:16 GMT";

        "Transfer-Encoding" = Identity;

        "X-Powered-By" = "Servlet/2.5 JSP/2.1";
    å

     

     

     

    解决方法:

    全工程搜索AFURLResponseSerialization.m文件

    修改223行:

    self.acceptableContentTypes = [NSSetsetWithObjects:@"application/json", @"text/html",@"text/json",@"text/javascript", nil];

    加上蓝色部分,其实就是添加一种服务器返回的数据格式。

    亲测,好使。

  • 相关阅读:
    CF891E Lust
    Comet OJ 2019 夏季欢乐赛题解
    CF1098E Fedya the Potter
    CF1063F String Journey
    P4218 [CTSC2010]珠宝商
    AGC028 E
    51Nod 1584 加权约数和
    51Nod 1769 Clarke and math2
    Educational Codeforces Round 67
    斯特林数学习笔记
  • 原文地址:https://www.cnblogs.com/6duxz/p/4545277.html
Copyright © 2011-2022 走看看