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. margin传递,子元素的上下margin会传递给父级

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  2. Android多线程下安全访问数据库

    http://zhiwei.neatooo.com/blog/detail?blog=5343818a9d4869f0310000de github 原文https://github.com/dmyt ...

  3. HDU - 5234 Happy birthday

    Problem Description Today is Gorwin’s birthday. So her mother want to realize her a wish. Gorwin say ...

  4. 2333: [SCOI2011]棘手的操作[写不出来]

    2333: [SCOI2011]棘手的操作 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1979  Solved: 772[Submit][Stat ...

  5. The Accumulation of Capital

    The Accumulation of Capital ---- by *Adam Smith Capitals are increased by parsimony, and diminished ...

  6. drawable文件夹详解

    QVGA使用ldpi,虽然有不同尺寸,但都是120dpi左右:HVGA同理:如下图: -finger    用于触摸屏的设备 -hdpi    近似于240dpi的高级显示密度的屏幕 -mdpi    ...

  7. elasticsearch 管理工具

    ------------------sense------------------- google chrome 浏览器插件,数据交互使用   -------------------------hea ...

  8. ural1542 Autocompletion

    Autocompletion Time limit: 2.0 secondMemory limit: 64 MB The Japanese are infinitely in love with ma ...

  9. android 修改listview item view 的方法(转)

    android 修改listview item view 的方法   具体的解答办法很简单: 代码如下 : 1.获取需要更新的view int visiblePosition = mListView. ...

  10. 3D动画效果照片墙demo

        <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF- ...