iOS- "unacceptable content-type: text/plain"等content-type bug解决方式
2017-07-09 16:12
681 查看
常常在使用AFN的时候会出现content-type错误,缺少请求类型,比方”unacceptable content-type: text/plain”
解决方法:
1.在网络请求代码处改动
AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager]; mgr.responseSerializer = [AFHTTPResponseSerializer serializer];
2.直接改动AFN源文件
1)找到AFN设定Content-type的地方
复制用-> AFURLResponseSerialization.m
将
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",nil];
改动为:
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/plain" ,nil];
缺少什么类型的content-type ,添加对应的.
相关文章推荐
- iOS- "unacceptable content-type: text/plain"等content-type bug解决方案
- iOS中,修改AFNetworking源文件可接收text/plain的方法"Request failed: unacceptable content-type: text/plain"
- iOS"Request failed: unacceptable content-type: text/html"
- iOS"Request failed: unacceptable content-type: text/html"
- iOS"Request failed: unacceptable content-type: text/html"
- iOS-AFN "Request failed: unacceptable content-type: text/plain"
- iOS"Request failed: unacceptable content-type: text/html"
- AFNetworking不支持text/plain,错误解决方法"Request failed: unacceptable content-type: text
- 解决AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误
- iOS AFN请求返回错误:"Request failed: unacceptable content-type: text/html"
- AFNetworking 遇到错误 Code=-1016 "Request failed: unacceptable content-type: text/plain"
- iOS上传失败提示"Request failed: unacceptable content-type: text/html"
- iOS"Request failed: unacceptable content-type: text/html"
- iOS开发 AFNetWork "Request failed: unacceptable content-type: text/html"
- AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误解决方法
- AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误解决方法
- OS"Request failed: unacceptable content-type: text/html"
- iOS"Request failed: unacceptable content-type: text/html"
- Request failed: unacceptable content-type: text/html" UserInfo=0x7c05169
- iOS 9 Afnetworking 3.0 Request failed: unacceptable content-type: text/plain