AFNetworking上传遇到的小问题

来源:互联网 发布:打开钱箱的软件 编辑:程序博客网 时间:2024/04/30 11:54

上传图片时出现的问题:

{ 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 = [NSSetsetWithObjects:@"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

0 0
原创粉丝点击