常常在使用AFN的时候会出现content-type错误,缺少请求类型,比方”unacceptable content-type: text/plain”

解决方法:

1.在网络请求代码处改动

AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager];
mgr.responseSerializer = [AFHTTPResponseSerializer serializer];

2.直接改动AFN源文件

1)找到AFN设定Content-type的地方

复制用-> AFURLResponseSerialization.m

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

改动为:

self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/plain" ,nil];

缺少什么类型的content-type ,添加对应的.

iOS- "unacceptable content-type: text/plain"等content-type bug解决方式的更多相关文章

  1. {"timestamp":"2019-11-12T02:39:28.949+0000","status":415,"error":"Unsupported Media Type","message":"Content type 'text/plain;charset=UTF-8' not supported","path":&quo

    在Jmeter运行http请求时报错: {"timestamp":"2019-11-12T02:39:28.949+0000","status&quo ...

  2. 遇到问题之“postman报Unsupported Media Type: Content type 'text/plain;charset=UTF-8' not supported”

    postman报Unsupported Media Type: Content type 'text/plain;charset=UTF-8' not supported postman之所以报Uns ...

  3. Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法

    http://www.2cto.com/os/201312/262437.html 安装了VS2012之后,chrome在加载页面的时候会报 Resource interpreted as Scrip ...

  4. Resource interpreted as Stylesheet but transferred with MIME type text/plain

    今天碰到了Resource interpreted as Stylesheet but transferred with MIME type text/plain 这个错误. 原因:在web中配置了f ...

  5. No handler for type [text] declared on field [content]

    Install 1.compile checkout ik version respective to your elasticsearch version git checkout tags/{ve ...

  6. Resource interpreted as Script but transferred with MIME type text/plain:

    我用script做ajax跨域,请求返回的是个文本字符串,chrome提示:Resource interpreted as Script but transferred with MIME type ...

  7. 解决 jersey 单jar包 IME media type text/plain was not found.

    1.maven-assembly-plugin  换成 --> maven-shade-plugin <plugins> <!-- shade插件打包成jar包 --> ...

  8. iOS-AFN "Request failed: unacceptable content-type: text/plain"

    今天使用AFN测试程序时,返回如下错误 这是由于AFN默认不支持http返回结果为"text/plain"这种类型所致. 解决办法: 找到AFN框架中的AFURLResponseS ...

  9. RestTemplate 微信接口 text/plain HttpMessageConverter

    一.背景介绍 使用 Spring Boot 写项目,需要用到微信接口获取用户信息. 在 Jessey 和 Spring RestTemplate 两个 Rest 客户端中,想到尽量不引入更多的东西,然 ...

随机推荐

  1. POJ 1985 求树的直径 两边搜OR DP

    Cow Marathon Description After hearing about the epidemic of obesity in the USA, Farmer John wants h ...

  2. 在linux系统中,使用tomcat的shutdown.sh脚本停止应用,但是进程还在的解决办法

    基本原理为启动tomcat时记录启动tomcat的进程id(pid),关闭时强制杀死该进程 第一步 :vi 修改tomcat下bin/catalina.sh文件,增加几行脚本,主要是记录tomcat的 ...

  3. xhtml1-transitional.dtd

    <!-- Extensible HTML version 1.0 Transitional DTD This is the same as HTML 4 Transitional except ...

  4. Android第一次项目

    学习了一个月的Android,接触了人生中第一个安卓项目,对于一个小白来说,总结是很重要的学习方法,以下我把学到的东西总结以下: 1. 1>okhttp3用法解析(边贴代码边熟悉) public ...

  5. 附加MySQL数据库的方法

    下面讲解附加MySQL数据库的方法. (1)将“光盘\Code\04\Project\数据库”文件夹中的扩展名为.sql的文件拷贝到本地机器中. (2)在如图1所示的MySQL工作台界面中,单击Dat ...

  6. SLAM: 图像角点检测的Fast算法(OpenCV文档)

    官方链接:http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_fast/py_fast.html#fast-algorithm- ...

  7. Vs2010删除空白行

    在copy了别人的代码之后,出现了大量的空白行,批量删除空白行方法为: 查找内容:^:b*$\n 替换为: 查找范围:当前文档 使用:正则表达式

  8. Step by Step 开发dynamics CRM

    这里是作为开发贴的总结. 现在plugin和workflow系列已经终结. 希望这些教程能给想入坑的小伙伴一些帮忙. CRM中文教材不多, 我会不断努力为大家提供更优质的教程. Plugin 开发系列 ...

  9. matlab学习使用Button Group绘制不同的正弦曲线

    创建buttongroup控件---即按钮组 再添加三个radiobutton 对其设置 buttongroup控件改Title为绘制不同正弦曲线 第一个radiobutton的string改为sin ...

  10. js数组操作find查找特定值结合es6特性

    js数组操作find查找特定值结合es6特性