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源代码目录找到AFURLResponseSerialization.m文件将里面的代码:

 

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

    修改为:

    self.acceptableContentTypes =[NSSetsetWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",nil];

 

人已赞赏
iOS文章

iOS CALayer 属性说明

2019-10-15 11:30:50

iOS文章

OC 钥匙串使用

2019-10-15 14:24:42

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索