iOS- "unacceptable content-type: text/plain"等content-type bug解决方式
常常在使用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解决方式的更多相关文章
- {"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 ...
- 遇到问题之“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 ...
- 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 ...
- Resource interpreted as Stylesheet but transferred with MIME type text/plain
今天碰到了Resource interpreted as Stylesheet but transferred with MIME type text/plain 这个错误. 原因:在web中配置了f ...
- No handler for type [text] declared on field [content]
Install 1.compile checkout ik version respective to your elasticsearch version git checkout tags/{ve ...
- Resource interpreted as Script but transferred with MIME type text/plain:
我用script做ajax跨域,请求返回的是个文本字符串,chrome提示:Resource interpreted as Script but transferred with MIME type ...
- 解决 jersey 单jar包 IME media type text/plain was not found.
1.maven-assembly-plugin 换成 --> maven-shade-plugin <plugins> <!-- shade插件打包成jar包 --> ...
- iOS-AFN "Request failed: unacceptable content-type: text/plain"
今天使用AFN测试程序时,返回如下错误 这是由于AFN默认不支持http返回结果为"text/plain"这种类型所致. 解决办法: 找到AFN框架中的AFURLResponseS ...
- RestTemplate 微信接口 text/plain HttpMessageConverter
一.背景介绍 使用 Spring Boot 写项目,需要用到微信接口获取用户信息. 在 Jessey 和 Spring RestTemplate 两个 Rest 客户端中,想到尽量不引入更多的东西,然 ...
随机推荐
- windows phone数据网络开发
LINQ LINQ的全称是Language INtegrated Query,即语言集成查询.LINQ是一种查询语言,不仅可以对数字库进行查询,还可以对.net的数据集.数组.Xml文档等对象进行查询 ...
- 笔记 — 动画效果(Css3)
/** * animation-name: 调用 @keyframes 所定义的动画 * animation-duration: 动画周期所花费的时间长度 * animation-timing-fun ...
- 4 Things I Wish I Would Have Known When I Started My Software Development Career【当我最开始从事软件工程师的时候我希望我知道的四件事】
英文原文:http://simpleprogrammer.com/2013/08/19/software-development-career/ My software development car ...
- js match 来点击切换图片
定义和用法 match() 方法可在字符串内检索指定的值,或找到一个或多个正则表达式的匹配. 该方法类似 indexOf() 和 lastIndexOf(),但是它返回指定的值,而不是字符串的位置. ...
- 【PostgreSQL-9.6.3】表继承
表继承是PostgreSQL特有的,子表可以从父表中继承字段和一些属性.例如: --创建一张表“persons”作为父表: test=# create table persons ( test(# i ...
- IIS日志分析:SC-Status语义
在网站属性-网站-日志(属性) 中进行设定该站点IIS日志常规属性和扩展属性,扩展属性设置IIS日志包含字段显示. HTTP协议状态(sc-status)码的含义 IIS中 100 Continue ...
- 2、scala条件控制与循环
1. if表达式 2. 句终结符.块表达式 3. 输入与输出 4. 循环 5. 高级for循环 1. if表达式 if表达式的定义:scala中,表达式是有值的,就是if或者else中最后 ...
- C++对象的内存模型
1. 普通对象模型 对象是如何在内存中布局的? 成员 存放位置 访问范围 非静态数据成员 每一个对象体内 为该对象专有 静态数据成员 程序的静态存储区内,只有一份实体 为该类所有对象共享 成员函数(静 ...
- ubuntu操作系统的目录结构
/:根目录,是所有目录的绝对路径的起始点.一般根目录下只存放目录,不要存放文件,/etc./bin./dev./lib./sbin应该和根目录放置在一个分区中 /bin (类似的还有/usr/bin) ...
- REST ful
前后端分离.面向资源.无状态: 请求包含全部信息. 什么是 REST? 下面六条准则定义了一个 REST 系统的特征: 客户-服务器(Client-Server),提供服务的服务器和使用服务的客户需要 ...