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 客户端中,想到尽量不引入更多的东西,然 ...
随机推荐
- POJ1915 BFS&双向BFS
俩月前写的普通BFS #include <cstdio> #include <iostream> #include <cstring> #include <q ...
- HTML基础练习
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...
- asp.net MVC 路由注册
1.命名空间的优先级 在路由注册时指定的命名空间比当前 ControllerBuilder 的默认命名空间具有更高的匹配优先级,但是对于这两个集合中的所有命名空间却具有相同的匹配优先级.换句话说,用于 ...
- Obsolete---标记方法 类过期
最近做一个接口的修改,由于是很老的接口,不太了解外部有多少地方引用了它. 但是内部的方法由于业务发展已经不太适合现在的需求,想改又不该动.所以想到了如果设置为过期. Obsolete 属性将某个程序实 ...
- Lua Time
-- local getTime = os.date(“%c”); -- %a abbreviated weekday name (e.g., Wed)-- %A full weekday name ...
- ios -使用NSLayoutConstraint实现多个view等宽等高等间距
@interface ViewController () { UIView *firstView; UIView *secondView; UIView *thirdView; } @end @imp ...
- Shiny学习实践01
Shiny是什么东东? 官方描述: Shiny is an R package that makes it easy to build interactive web apps straight fr ...
- 1、Scala安装与基础
1.scala与java 2.安装 3.scala编译器 4.变量声明 5.数据类型 6.操作符 7.函数调用 8.apply函数 1.scala与java scala基于java虚拟机,所有scal ...
- 压缩映射:简单最邻近搜索-(SLH)Simple Linear Hash
Compact Projection: Simple and Efficient Near Neighbor Search with Practical memory Requirement Auto ...
- POJ_3020_最小路径覆盖
Antenna Placement Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8721 Accepted: 4330 ...