使用AFNetworking网络请求时出现错误"Request failed: unacceptable content-type: text/html"
来源:互联网 发布:阿里云 运营商 编辑:程序博客网 时间:2024/06/06 04:50
以前用的好端端的接口,今天访问居然出错了,但是再用浏览器测试,发现可以正常返回数据,甚是奇怪啊。
下面是错误信息:
获取服务器响应出错
} }, NSErrorFailingURLKey=http://172.16.1.31:7001/itom/getwork, com.alamofire.serialization.response.error.data=<5b7b2273 74617475 73223a22 73756363 65737322 2c226d73 67223a22 e799bbe9 9986e688 90e58a9f 227d5d>, NSLocalizedDescription=Request failed: unacceptable content-type: text/html}
I also encountered the same problem. This means that your server is sending "text/html"
"text/html"
acceptableContentTypes
AFURLResponseSerializati
@"text/html"
I hope this helps you. Best regards and less bugs as possible in the code.
op.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html”];
对应到自己的项目里面,我用的是AFNetworking这套网络请求包,需要改的是:
AFURLResponseSerializati
223行:
self.acceptableContentTypes
加上蓝色部分,其实就是添加一种服务器返回的数据格式。
- 使用AFNetworking网络请求时出现错误"Request failed: unacceptable content-type: text/html"
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法
- AFNetWorking请求时, “Request failed: unacceptable content-type: text/html”
- AFNetWorking 错误Request failed: unacceptable content-type: text/html"
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type错误解决方法
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: XXXX 解决方法
- iOS 使用AFNetworking遇到错误 Request failed: unacceptable content-type: text/html
- iOS 使用AFNetworking遇到错误 Request failed: unacceptable content-type: text/html
- AFNetworking 报错 Request failed: unacceptable content-type: text/html
- AFNetworking 报错Request failed: unacceptable content-type: text/html"
- AFNetworking 错误 Request failed: unacceptable content-type: text/plain
- AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误解决方法
- AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误解决方法
- 解决AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误
- 使用AFNetworking遇到异常 Request failed: unacceptable content-type: text/html
- iOS 使用AFNetworking遇到异常 Request failed: unacceptable content-type: text/html
- Request failed: unacceptable content-type: text/html
- FragmentActivity和Activity
- js 多个倒计时,毫秒倒计时
- 快的打车架构实践
- Android NDK开发之 NEON使用介绍
- 装饰模式
- 使用AFNetworking网络请求时出现错误"Request failed: unacceptable content-type: text/html"
- android中饼状图的实现方法
- Extjs3 grid 嵌套
- Valid Phone Numbers
- Spring MVC 中 HandlerInterceptorAdapter的使用
- javascript DOM
- 提升 DevOps 效率,试试 ChatOps 吧!
- Android开发学习笔记:Intent的简介以及属性的详解
- java中使用XStream实现将对象转为xml格式字符串或者将xml格式的字符串转换为对象