iOS-AFNetWoring请求时遇到的bug小集合

释放双眼,带上耳机,听听看~!
{ 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 = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];

改为

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

 

人已赞赏
iOS文章

iOS金额转大写

2019-9-19 21:40:01

iOS文章

iOS多次push,返回指定根模块

2019-9-19 22:40:52

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