问题— 修改AFNetworking源文件可接收text/plain的方法
2015-10-23 18:48
459 查看
在使用AFNetworking的时候可能会碰到下面的错误:
此时需要修改AFNetworking可接收的Content-Type,前往AFNetworking源代码目录找到AFURLResponseSerialization.m文件将里面的代码:
{ status code: 200, headers { "Content-Length" = 14; "Content-Type" = "text/plain;charset=utf-8"; Date = "Thu, 22 May 2014 10:37:50 GMT"; Server = "Apache-Coyote/1.1"; "Set-Cookie" ="JSESSIONID=C0DFED60A154557F8386E62AB2A066CE; Path=/FHJRDT"; } }, NSLocalizedDescription=Request failed:unacceptable content-type: text/plain}
此时需要修改AFNetworking可接收的Content-Type,前往AFNetworking源代码目录找到AFURLResponseSerialization.m文件将里面的代码:
self.acceptableContentTypes =[NSSetsetWithObjects:@"application/json",@"text/json",@"text/javascript",nil]; 修改为: self.acceptableContentTypes =[NSSetsetWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",nil];
相关文章推荐
- org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
- Domain=NSCocoaErrorDomain Code=3000 没有找到有Push属性的证书 更新证书失败
- Paint对象使用解析【不断更新中】
- xcode 真机编译codesign failed with exit code 1错误 解决
- WARN Worker: Failed to connect to master
- Saiku国际化总结
- 软件安全测试新武器 ——浅谈基于Dynamic Taint Propagation的测试技术
- AIDL 源码窥探
- explain分析查询
- IIS runs out of work items and causes RPC failures when connecting to a remote UNC path
- int main(int argc,char* argv[])详解
- Mac下通过proxychains-ng配置thunderbird来访问gmail
- FIFA 16 comes in with FIFA trainer that will try
- liunx 下scp出现 Permission denied, please try again 的解决办法
- hive环境搭建 Terminal initialization failed; falling back to unsupported 解决
- lucene Lock obtain timed out: Lock@
- Afaira服务器上报错NDEF invalid "Operation" tag
- A Detailed Introduction to K-Nearest Neighbor (KNN) Algorithm
- 运行报错“Could not find a storyboard named 'Main' in bundle”
- 当人工智能机器人具有七情六欲