ref:http://blog.csdn.net/nyh1006/article/details/25068255

1、错误信息:Error:Error Domain=AFNetworkingErrorDomain Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo=0x16dcec00 {NSErrorFailingURLKey=http://www.weather.com.cn/data/sk/101110101.html, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x16d5deb0> { URL: http://www.weather.com.cn/data/sk/101110101.html } { status code: 200, headers {
    Connection = "keep-alive";
    "Content-Encoding" = gzip;
    "Content-Type" = "text/html; charset=utf-8";
    Date = "Mon, 05 May 2014 09:40:27 GMT";
    Server = "Apache/2.2.0";
    "Transfer-Encoding" = Identity;
} }, NSLocalizedDescription=Request failed: unacceptable content-type: text/html}

原因:

AFNetworking  默认不支持text/html

AFURLResponseSerialization.m 源码  ->   self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];

解决办法:

1)在作者源代码处添加 @"text/html" 。

2)在自己的代码处加上这句代码:

manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];

 缺什么类型就填那种类型,比如我是 text/plain

参考的资料:

http://www.cocoachina.com/bbs/simple/?t176000.html

http://www.cocoachina.com/ask/questions/show/108598

https://github.com/AFNetworking/AFNetworking/blob/master/README.md

AFNetworking content type not support的更多相关文章

  1. Java之POI读取Excel的Package should contain a content type part [M1.13]] with root cause异常问题解决

    Java之POI读取Excel的Package should contain a content type part [M1.13]] with root cause异常问题解决 引言: 在Java中 ...

  2. org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported

    最后找到我的问题,springmvc配置文件中没加 <mvc:annotation-driven/> java代码: @RequestMapping(value="/reques ...

  3. Content type 'application/json;charset=UTF-8' not supported异常的解决过程

    首先说一下当时的场景,其实就是一个很简单的添加操作,后台传递的值是json格式的,如下图 ,后台对应的实体类, @Data @EqualsAndHashCode(callSuper = false) ...

  4. Jsoup问题---获取http协议请求失败 org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml.

    Jsoup问题---获取http协议请求失败 1.问题:用Jsoup在获取一些网站的数据时,起初获取很顺利,但是在访问某浪的数据是Jsoup报错,应该是请求头里面的请求类型(ContextType)不 ...

  5. Jsoup获取部分页面数据失败 org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml.

    用Jsoup在获取一些网站的数据时,起初获取很顺利,但是在访问某浪的数据是Jsoup报错,应该是请求头里面的请求类型(ContextType)不符合要求. 请求代码如下: private static ...

  6. SharePoint自动化系列——Add content type to list.

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 将创建好的content type(若是跨web application需要事先publish c ...

  7. SharePoint自动化系列——Content Type相关timer jobs一键执行

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 背景: 在SharePoint Central Administration->Monito ...

  8. 转载 SharePoint【Site Definition 系列】– 创建Content Type

    转载原地址:  http://www.cnblogs.com/wsdj-ITtech/archive/2012/09/01/2470274.html Sharepoint本身就是一个丰富的大容器,里面 ...

  9. 安卓开发错误:The type android.support.v4.app.TaskStackBuilder$SupportParentable cannot be resolved.

    今天在使用低版本下的ActionBar,在继承ActionBarActivity时报了"The type Android.support.v4.app.TaskStackBuilder$Su ...

随机推荐

  1. building system busy, pls wait !!

    编译ca是可能会报这个错误,是189服务器上的/home/pub-work/.android_build_lock这个文件的问题,删除即可.

  2. js框架——angular.js(5)

    1. 3种过滤方式 <html> <head> <meta charset='utf-8'> <script src="js/angular.js& ...

  3. 使用命令行编译as文件成swf

    设置环境变量到flex sdk的目录下.如:D:\Program Files\Adobe Flash Builder 4.5\sdks\flex_sdk_4.6\bin 找到flex-config.x ...

  4. for循环与foreach

    注意点: for循环时,可以对集合进行操作,但foreach循环中,对集合进行操作会报错:                  for 循环可以获取下标 如下代码: package com.tt;imp ...

  5. 微信小程序页面-页面跳转失败WAService.js:3 navigateTo:fail url not in app.json

    微信小程序新建页面的要素一是新建的文件名称和其子文件的名称最好一致,不然容易出问题,在小程序页面跳转中如果出现WAService.js:3 navigateTo:fail url not in app ...

  6. bluehost 邮箱设置问题

    问题描述: e-elitech.com域名,elitechus.com域名均在阿里云注册,en.e-elitech.com解析到bluehost虚拟主机,www.elitechus.com也解析到bl ...

  7. 转:移植SlidingMenu Android library,和安装example出现的问题解决

    很多项目都用到类似左侧滑动菜单的效果,比如facebook,evernote,VLC for android等等,这很酷 源代码可以从GitHub的https://github.com/jfeinst ...

  8. 简单查询plan

    -> alter session set statistics_level=all; select /*+ gathe_plan_statistics */ * from ts.ts_recor ...

  9. (转) hadoop 一个Job多个MAP与REDUCE的执行

    http://blog.csdn.net/chaoping315/article/details/6221440 在hadoop 中一个Job中可以按顺序运行多个mapper对数据进行前期的处理,再进 ...

  10. cc2530操作任务系统初始化分析

    操作系统任务初始化void osalInitTasks( void ){ uint8 taskID = 0; // 分配内存,返回指向缓冲区的指针 tasksEvents = (uint16 *)os ...