在发送请求后一直报错, 浏览器解析却没有问题, 所以基本可以确定是AFNetworking的问题

下面是解决方法:

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
// 添加这句代码
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
[manager GET:URLString parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
success(task, responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
failure(error);
}];

添加设置acceptableContentTypes后, 这个问题就解决了...

AFNetworking3.0出现Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable的更多相关文章

  1. 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 contr ...

  2. Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable con

    AFHTTPSessionManager * manager = [AFHTTPSessionManager manager]; manager.responseSerializer.acceptab ...

  3. iOS之AFN错误代码1016(Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable)

    请参考这篇博客:点击查看

  4. Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptabl

    在使用AFNetworking 2.0  的时候本来一切很顺畅,但是中途遇到几个比较坑的地方 这里分享一下爬坑经历,忘读者不能速爬坑! 在发送请求后,NSURLSessionDataTask一直报错 ...

  5. 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法

    使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法 添加一行 manager. ...

  6. AFNetworking 2.0 获取json数据时,返回 NSLocalizedDescription=Request failed: unacceptable content-type: text/html, 解决方法.

    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSe ...

  7. AFNetworking3.0 Post JSON数据

    使用AFNetworking3.0后网络请求由原来的AFHTTPRequestOperationManager变为AFHTTPSessionManager.一般的Post请求变成了这样: NSMuta ...

  8. AFNetworking3.0使用简介

    注意到咱们集成的版本为3.0.4. 下面的类已从AFNetworking 3.0中废弃: AFURLConnectionOperation AFHTTPRequestOperation AFHTTPR ...

  9. [ios] 定位报错Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"

    Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error ...

随机推荐

  1. poj 2886Who Gets the Most Candies?

    http://poj.org/problem?id=2886 #include <cstdio> #include <cstring> #include <algorit ...

  2. 感兴趣的Linux发行版

    1. Ubuntu,包括KUbuntu,XUbuntu,Kyrin等等 2. BluestarLinux - 基于Arch Linux,感觉很美 http://sourceforge.net/proj ...

  3. logstash (?m) 经典例子

    在和 codec/multiline 搭配使用的时候,需要注意一个问题,grok 正则和普通正则一样,默认是不支持匹配回车换行的.就像你需要 =~ //m 一样也需要单独指定,具体写法是在表达式开始位 ...

  4. fmt命令

    简单的格式化文本 fmt [option] [file-list] fmt通过将所有非空白行的长度设置为几乎相同,来进行简单的文本格式化 参数 fmt从file-list中读取文件,并将其内容的格式化 ...

  5. 【转】 android 4.4 Step Counter Sensor计步器的使用

    原文网址:http://blog.csdn.net/aikongmeng/article/details/40457233 版权声明:本文为博主原创文章,未经博主允许不得转载. Android 官方参 ...

  6. 计算机语言的发展(the history of computer's language)

    第一部分 计算机语言的分类: 机器语言:直接用二进制代码指令表达的计算机语言,指令是用0和1组成的一串代码.例如:1011011000000000,表示加法.可以直接执行. 汇编语言:汇编指令集.伪指 ...

  7. libevent的简单应用【转载】

    本文转载自: http://blog.csdn.net/liuguanghui1988/article/details/7090531 Libevent的应用主要围绕几大事件:超时事件.信号事件.读/ ...

  8. LeetCode-Add Two Binary

    Add BinaryApr 2 '12 3558 / 10570 Given two binary strings, return their sum (also a binary string). ...

  9. 高性能JSON工具-FastJson处理超大JSON文本

    使用阿里开源类库FastJson,当需要处理超大JSON文本时,需要Stream API,在fastjson-1.1.32版本中开始提供Stream API.文档参考GitHub:https://gi ...

  10. CodeForces 146E - Lucky Subsequence DP+扩展欧几里德求逆元

    题意: 一个数只含有4,7就是lucky数...现在有一串长度为n的数...问这列数有多少个长度为k子串..这些子串不含两个相同的lucky数... 子串的定义..是从这列数中选出的数..只要序号不同 ...