关于AFNetworking的一种错误!
来源:互联网 发布:淘宝100元左右的鼠标 编辑:程序博客网 时间:2024/06/06 09:55
今天用 AFNetworking 的时候不能解析,因为程序根本不往里面走(只到 [ manager GET … ] 就结束了) 并且有返回错误信息:
//一下是错误信息
Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7f9003e60c60> { URL: http://api.wap.miercn.com/api/2.0.3/pic_list.php?plat=android&proct=mierapp&versioncode=20150807&apiCode=4&page=1 } { status code: 200, headers {
Connection = "keep-alive";
"Content-Encoding" = gzip;
"Content-Type" = "text/html; charset=UTF-8";
Date = "Sat, 31 Oct 2015 03:44:25 GMT";
"Keep-Alive" = "timeout=2";
Server = "M_cdn";
"Transfer-Encoding" = Identity;
Vary = "Accept-Encoding";
"X-Powered-By" = "PHP/5.6.12";
} }, NSErrorFailingURLKey=http://api.wap.miercn.com/api/2.0.3/pic_list.php?plat=android&proct=mierapp&versioncode=20150807&apiCode=4&page=1, com.alamofire.serialization.response.error.data=<7b226572
====================等等=======================
30227d5d 7d>, NSLocalizedDescription=Request failed: unacceptable content-type: text/html}
关键原因是: NSLocalizedDescription=Request failed: unacceptable content-type: text/htm
然后在群里喊了一声,有朋友说是返回值的问题, AFNetworking 默认的返回值是JSON的, 让我在源文件修改一下就好,然后我在源文件(AFNetworking)的其中的 AFURLResponseSerialization.m 文件中, self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/json", nil]; 添加 @“text/html”( 意思就是它缺什么返回值类型,你给他添加上就是 ) 目前为止遇到的一种情况
- 关于AFNetworking的一种错误!
- 关于AFNetworking的一种错误!
- AFNetworking的错误码
- 关于AFNetworking的使用
- 关于AFNetworking的使用
- 关于AFNetworking的使用
- 关于AFNetworking框架的使用
- 关于java.lang.VerifyError的另外一种错误原因
- arm64的一种错误
- 关于AFNetworking
- AFNetWorking的-1016和3840错误
- 新版的AFNetworking请求方法错误
- AFNetworking请求错误的一二件事
- 关于AFNetworking 类库的一般用法
- 关于AFNetworking解析数据的基本使用方法
- 关于AFNetworking菊花转圈圈的问题
- 关于AFNetworking中header的bug问题
- ORA_04050错误的一种原因.
- 我遇到的kinect for windows2 USB不识别情况
- 单链表的反转
- 2015年大二上-数据结构-链表(4)-双链表算法库
- hdu5536
- Servlet学习笔记_03_使用servlet编写一个简单的helloworld程序
- 关于AFNetworking的一种错误!
- ubuntu 下如何使用svn
- arcgis锁
- 参数估计(续)
- 线程的优先级别
- 基本数据类型的转换和表示方法
- 上周二的一个面试(==)
- 11.3作业练习
- 基于OpenCV的Gabor变换及特征提取