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

最新文章

  1. [ASP.NET Core] Static File Middleware
  2. Liferay7 BPM门户开发之26: 集成Activiti到Liferay7
  3. 【云计算】开源的Docker Registry WebUI
  4. [Hibernate] - Study 1
  5. JS遇到的问题解决
  6. hdu 1018
  7. 分布式缓存BeIT Memcached简介
  8. HDU 1541 Stars (树状数组)
  9. C# 语言规范_版本5.0 (第1章 介绍)
  10. storybody中页面跳转
  11. Ninject之旅之十三:Ninject在ASP.NET MVC程序上的应用(附程序下载)
  12. VS2015 使用Xunit来进行单元测试
  13. AXI_DMA IP学习
  14. Linux超级守护进程&mdash;&mdash;xinetd
  15. [dart学习]第二篇:dart变量介绍 (一)
  16. 根据23423条件,截取字段‘abdecsdsadsadsad’,以ab/dec/sdsa/ds/ads 输出
  17. 遗忘Windows Server 2008R2密码的处理方法
  18. ref:linux用户和组管理,/etc/passwd,/etc/shadow和/etc/group 文件内容解释
  19. 转:Math: Math.atan() 与 Math.atan2() 计算两点间连线的夹角
  20. 记一次Castle报错

热门文章

  1. U盘安装Centos后拔除U盘无法启动问题解决方法
  2. gameUnity 网络游戏框架
  3. AI 人工智能 探索 (一)
  4. java 对象流
  5. 每个程序员都应该学习使用Python或Ruby
  6. 利用未文档化API:RtlAdjustPrivilege 提权实现自动关机
  7. [code]字母重排
  8. IIS判断W3WP进程对应哪个网站
  9. 将自己apk打包进其他apk安装思路
  10. copy ,abs,includes 3个函数