Connection = "keep-alive";
"Content-Encoding" = gzip;
"Content-Type" = "text/html; charset=utf-8";
Date = "Mon, 05 May 2014 09:40:27 GMT";
Server = "Apache/2.2.0";
"Transfer-Encoding" = Identity;
} }, NSLocalizedDescription=Request failed: unacceptable content-type: text/html}
原因:
AFNetworking 默认不支持text/html
AFURLResponseSerialization.m 源码 -> self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];
解决办法:
1)在作者源代码处添加 @"text/html" 。
2)在自己的代码处加上这句代码:
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
参考的资料:
http://www.cocoachina.com/bbs/simple/?t176000.html
http://www.cocoachina.com/ask/questions/show/108598
https://github.com/AFNetworking/AFNetworking/blob/master/README.md