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];
加上蓝色部分,其实就是添加一种服务器返回的数据格式。
亲测,好使。
iOS AFNetworking “Request failed: unacceptable content-type: text/html”问题的更多相关文章
- AFNetworking request failed unacceptable content type text/html
今天体验AFNetwork 3.1.0 进行数据解析,但是解析数据控制台一直都输出这样的 error 结果: 于是,照着以前AFN2.+版本的进行设置: 结果发现在新版本的 AFN 上不能设置了.既然 ...
- iOS 使用AFNetworking遇到错误 Request failed: unacceptable content-type: text/html
错误日志: Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacc ...
- iOS 使用AFNetworking遇到异常 Request failed: unacceptable content-type: text/html
错误日志是: Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unac ...
- AFNetworking遇到错误 Request failed: unacceptable content-type: text/html
iOS 使用AFNetworking遇到错误 Request failed: unacceptable content-type: text/html 原因: 不可接受的内容类型 “text/html ...
- iOS"Request failed: unacceptable content-type: text/html"
接口访问出错了,用浏览器测试,发现可以正常返回数据. 下面是错误信息: 获取服务器响应出错 error=Error Domain=com.alamofire.error.serialization.r ...
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法
使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法 添加一行 manager. ...
- AFNetworking 遇到错误 Code=-1016 "Request failed: unacceptable content-type: text/plain"
在开发过程使用了AFNetworking库,版本2.x,先运行第一个官方例子(替换GET 后面的url即可): AFHTTPRequestOperationManager *manager = [AF ...
- Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html"
2015-11-16 10:39:17.235 PullDemo[338:60b] Application windows are expected to have a root view contr ...
- NSLocalizedDescription=Request failed: unacceptable content-type: text/html 解决方法
使用AFNetworking请求一个网站出现了以下错误 Error Domain=com.alamofire.error.serialization.response Code=- "Req ...
随机推荐
- Django常用命令及参数配置(Django 1.8.6)
常用命令 #新建Django项目 django-admin startproject mysite(项目名) #新建一个APP cd mysite python manager.py startapp ...
- Mysql对用户操作加审计功能——高级版
在MYSQL中,每个连接都会先执行init-connect,进行连接的初始化.我们可以在这里获取用户的登录名称和thread的ID值.然后配合binlog,就可以追踪到每个操作语句的操作时间,操作人等 ...
- 特效合集(原生JS代码)适合初学者
1.返回顶部(完全兼容各个浏览器,不含美化) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" & ...
- Android学习笔记(二)
Google在Android4.0之后加入了Action Bar的功能.但是有时候标题栏会相当占用屏幕空间,使得内容区域变小,这里演示如何隐藏标题栏. 隐藏标题栏的方法很简单,打开上节的FirstAc ...
- visualSVN Server 设置外网可连接
首先再根节点右键,打开属性菜单. 打开Network选项卡,在Server name一栏中填入主机域名或者是ip. 然后在创建的项目中单机或者右键,就可以得到访问地址了.
- Centos6.4 用rpm方式安装MySql5.6
1.查看系统是否安装了MySQL 使用命令: #rpm -qa | grep mysql 2.卸载已安装的MySQL 卸载mysql命令如下: #rpm - ...
- NODEJS - express
1.express组织结构 app demo |---node_modules------用于安装本地模块. |---public------------用于存放用户可以下载到的文件,比 ...
- hive基本操作
hive级联删除数据库和表 drop database t1 cascade; hive创建临时表和插入 create table t1 as select * from achi; insert i ...
- 39. Recover Binary Search Tree && Validate Binary Search Tree
Recover Binary Search Tree OJ: https://oj.leetcode.com/problems/recover-binary-search-tree/ Two elem ...
- [EventBus源码解析] EventBus.post 方法详述
前情概要 上一篇blog我们了解了EventBus中register/unregister的过程,对EventBus如何实现观察者模式有了基本的认识.今天我们来看一下它是如何分发一个特定事件的,即po ...