zoukankan      html  css  js  c++  java
  • OC Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html"

    2015-11-16 10:39:17.235 PullDemo[338:60b] Application windows are expected to have a root view controller at the end of application launch

    2015-11-16 10:39:17.500 PullDemo[338:60b] Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo=0x8d3a640 {com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x8d559f0> { URL: http://www.baidu.com/ } { status code: 200, headers {

        "Cache-Control" = "no-cache";

        Connection = "Keep-Alive";

        "Content-Encoding" = gzip;

        "Content-Length" = 3174;

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

        Date = "Mon, 16 Nov 2015 02:39:17 GMT";

        Server = apache;

        "Set-Cookie" = "H_WISE_SIDS=100037; path=/; domain=.baidu.com";

        traceid = 144764155704053939308606070253431897318;

    } }, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=Request failed: unacceptable content-type: text/html,

    afnetworking的这个错误大家不陌生吧,解决方法

    AFURLResponseSerialization.m的223行加上@"text/html"就可以解决了

    或者请求的时候添加一句代码:

    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json",@"text/html",@"image/png",@"text/html;charset=UTF-8",@"text/plain", nil];
    
  • 相关阅读:
    c语言学习笔记(6)——for和while循环
    c语言学习笔记(5)——进制
    c语言学习笔记(4)——流程控制
    ckeditor复制粘贴word
    java上传超大文件
    plupload上传整个文件夹
    vue+上传文件夹
    php+上传大文件
    web+文件夹上传
    2G以上的大文件如何上传
  • 原文地址:https://www.cnblogs.com/hualuoshuijia/p/4971535.html
Copyright © 2011-2022 走看看