NSLocalizedDescription=Request failed: unacceptable content-type: text/html 解决方法
使用AFNetworking请求一个网站出现了以下错误
Error Domain=com.alamofire.error.serialization.response Code=- "Request failed: unacceptable content-type: text/html" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7fc688f34d00> { URL: http://xxx.xxx.xxx }
{ status code: , headers {
"Content-Encoding" = gzip;
"Content-Type" = "text/html";
Date = "Sat, 10 Oct 2015 13:44:28 GMT";
Server = "nginx/1.4.1";
Vary = "Accept-Encoding";
"X-Cache" = "MISS from RJ-ZSBGP-CDN-75";
"X-Powered-By" = "PHP/5.4.16";
} }, NSErrorFailingURLKey=http://xxx.xxx.xxx, com.alamofire.serialization.response.error.data=<7b227374 61746522 3a227375 63636573 73222c22 6d657373 61676522 3a22222c 22726573 756c7422 3a5b5d7d>, NSLocalizedDescription=Request failed: unacceptable content-type: text/html}
解决方法:
修改AFNetworking中AFURLResponseSerialization.m文件
在223行,将
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];
改成
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/html",@"text/json", @"text/javascript", nil];
增加了一个 @"text/html"
如果你不是在wb145230博客园看到本文,请点击查看原文.
NSLocalizedDescription=Request failed: unacceptable content-type: text/html 解决方法的更多相关文章
- AFNetworking request failed unacceptable content type text/html
今天体验AFNetwork 3.1.0 进行数据解析,但是解析数据控制台一直都输出这样的 error 结果: 于是,照着以前AFN2.+版本的进行设置: 结果发现在新版本的 AFN 上不能设置了.既然 ...
- AFNetworking 2.0 获取json数据时,返回 NSLocalizedDescription=Request failed: unacceptable content-type: text/html, 解决方法.
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSe ...
- iOS"Request failed: unacceptable content-type: text/html"
接口访问出错了,用浏览器测试,发现可以正常返回数据. 下面是错误信息: 获取服务器响应出错 error=Error Domain=com.alamofire.error.serialization.r ...
- 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 ...
- 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 ...
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法
使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法 添加一行 manager. ...
- iOS AFNetworking “Request failed: unacceptable content-type: text/html”问题
使用AFNetworking出现报错: error=Error Domain=com.alamofire.error.serialization.response Code=-1016 "R ...
- AFNetworking 遇到错误 Code=-1016 "Request failed: unacceptable content-type: text/plain"
在开发过程使用了AFNetworking库,版本2.x,先运行第一个官方例子(替换GET 后面的url即可): AFHTTPRequestOperationManager *manager = [AF ...
随机推荐
- Guava中TreeRangeMap基本使用
RangeMap跟一般的Map一样.存储键值对,依照键来取值.不同于Map的是键的类型必须是Range,也既是一个区间.RangeMap在Guava中的定义是一个接口: public interfac ...
- C/C++ 笔试、面试题目大汇总2
http://www.cnblogs.com/fangyukuan/archive/2010/09/18/1830493.html 一.找错题 试题1: void test1() { charstri ...
- js进阶 9-12 js如何实现级联菜单 (章节测试)
js进阶 9-12 js如何实现级联菜单 (章节测试) 一.总结 一句话总结: 1.js如何实现级联菜单 ? 二维数组,以第一级菜单的文本值做键,以对应的二级菜单选项的文本做值 2.用哪个属性可以获 ...
- js进阶 9-8 html标签如何实现禁止复制和粘贴
js进阶 9-8 html标签如何实现禁止复制和粘贴 一.总结 一句话总结: 1.在oncopy方法中return false即可阻止在控件中复制内容 2.在onpaste方法中return fal ...
- 小强的HTML5移动开发之路(35)——jQuery中的过滤器详解
1.基本过滤选择器 :first :last :not(selector) :selector匹配的节点之外的节点 :even :偶数 :odd :奇数 :eq(index) :gt(index) : ...
- 每天一个JavaScript实例-铺货鼠标点击位置并将元素移动到该位置
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- Android核心功能开发SearchView使用的开发(代码共享)
在Android上.搜索是一个核心的用户功能.用户可以搜索可用的任何数据,的内容是否存储在设备本身或者需要促进网络接入上.Android它提供了一个框架,为用户创造一个一致的搜索的搜索体验,它可以帮你 ...
- node服务器如何部署https证书
var http = require('http'); var https = require('https'); var path = require('path'); var fs = requi ...
- Android Studio 报错Guest isn't online after 7 seconds 解决方案
最近使用真机模拟之后,再使用虚拟机就频繁出现这个问题; 解决步骤如下: 1.打开Android虚拟设备管理器, 2.查看Actoins栏下拉图标, 3.选择冷启动模式即可, 4.重启AVD正常;
- IP packet transmission using vehicular transport
In one embodiment, a first stationary router may detect a disconnected backhaul link to a destinatio ...