AFNetworking上传遇到的小问题

上传图片时出现的问题:

{ status code: 200, headers {

    Connection = "Keep-Alive";

    "Content-Encoding" = gzip;

    "Content-Length" = 386;

    "Content-Type" = "text/html; charset=utf-8";

    Date = "Wed, 21 Jan 2015 05:45:47 GMT";

    "Keep-Alive" = "timeout=5, max=100";

    Server = "Apache/2.4.7 (Ubuntu)";

    Vary = "Accept-Encoding";

    "X-Powered-By" = "PHP/5.5.9-1ubuntu4.5";

} }, NSLocalizedDescription=Request failed: unacceptable content-type: text/html}


AFURLResponseSerialization类中找到acceptableContentTypes添加“text/html”

如下:

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


解决方法

http://stackoverflow.com/questions/19114623/request-failed-unacceptable-content-type-text-html-using-afnetworking-2-0

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。