美文网首页
AFNetWoring请求时遇到的bug小集合

AFNetWoring请求时遇到的bug小集合

作者: WuNai | 来源:发表于2016-10-11 15:43 被阅读31次
{ 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];

相关文章

网友评论

      本文标题:AFNetWoring请求时遇到的bug小集合

      本文链接:https://www.haomeiwen.com/subject/omrbyttx.html