zoukankan      html  css  js  c++  java
  • iOS 笔记-AFN使用中的遇到的问题

    今天使用AFN做注册时,控制台输出如下

    Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/plain" UserInfo=0x16d6ccc0 {com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x16ef0620> { URL: http://192.168.1.60:8078/video/common/appvideo!register.erun } { status code: 200, headers {

        "Content-Length" = 109;

        "Content-Type" = "text/plain;charset=UTF-8";

        Date = "Mon, 14 Dec 2015 03:13:09 GMT";

        Server = "Apache-Coyote/1.1";

    } }, NSErrorFailingURLKey=http://192.168.1.60:8078/video/common/appvideo!register.erun, NSLocalizedDescription=Request failed: unacceptable content-type: text/plain, com.alamofire.serialization.response.error.data=<7b227265 73756c74 223a22e6 b3a8e586 8ce5a4b1 e8b4a52c e6898be6 9cbae58f b7e7a081 e5b7b2e7 bb8fe6b3 a8e5868c 2ce8afb7 e69bb4e6 8da2e689 8be69cba e58fb7ef bc81222c 226d7367 223a22e6 b3a8e586 8ce5a4b1 e8b4a522 2c227375 63636573 73223a66 616c7365 7d>}

    重点在红色那句,经查证得知是AFN中的问题,需修改三方库中

    AFURLResponseSerialization.m文件223行,

    self.acceptableContentTypes = [NSSetsetWithObjects:@"application/json", @"text/plain",@"text/json",@"text/javascript", nil];

    由此便解决问题了~

  • 相关阅读:
    nginx基本命令
    一堆LCT板子
    17?17!
    ……妈妈我会写维修数列了!
    bzoj3744 Gty的妹子序列
    Noip2016 总结&反思
    bzoj4025 二分图
    [SHOI2008]堵塞的交通traffic
    bzoj4237 稻草人
    BestCoder Round #90
  • 原文地址:https://www.cnblogs.com/ruixin2222/p/5045236.html
Copyright © 2011-2022 走看看