首页 > 移动平台 > 详细

iOS—修改AFNetworking源文件可接收text/plain的方法

时间:2014-06-05 06:01:10      阅读:430      评论:0      收藏:0      [点我收藏+]

iOS—修改AFNetworking源文件可接收text/plain的方法

 

在使用AFNetworking候可能会碰到下面的错误

 

{ 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];

 

 

self.acceptableContentTypes =[NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript" , @"text/plain" , nil];

iOS—修改AFNetworking源文件可接收text/plain的方法,布布扣,bubuko.com

iOS—修改AFNetworking源文件可接收text/plain的方法

原文:http://blog.csdn.net/ally_ideveloper/article/details/27233211

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!