AFNetWorking请求时, “Request failed: unacceptable content-type: text/html”
2016-07-28 14:24
716 查看
解决方法1:
在AFNetWorking的源文件AFURLResponseSerialization.m中修改代码:
修改228行:
改为:
解决方法2:
如果不在在AFNetWorking的源文件中修改,在网络请求代码中添加@”text/html”
在AFNetWorking的源文件AFURLResponseSerialization.m中修改代码:
修改228行:
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];
改为:
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
解决方法2:
如果不在在AFNetWorking的源文件中修改,在网络请求代码中添加@”text/html”
AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager]; mgr.responseSerializer=[AFJSONResponseSerializer new]; mgr.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"text/html", nil];
相关文章推荐
- UIWindow&UIWindowLevel
- KendoUI学习笔记(类图)
- Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
- LeetCode-Wiggle Subsequence
- Android酷炫实用的开源框架(UI框架)
- 题号未知 , Array Queries 【RMQ】
- StringBuffer和StringBuilder
- Vue新手向 知乎日报 by Vue.js
- Android UI系列-----ImageView的scaleType属性
- QT Creator 使用 design 修改 ui界面编译后界面未更新问题的解决 From EricQu
- SPOJ 375 Query on a tree(树链剖分)
- 外观数列(Look-and-say sequence)
- BlockingQueue
- 安装GRID时跑root.sh脚本报错(ORA-27091: unable to queue I/O)
- HDUOJ 1216 - Assistance Required
- STL 之 priority_queue
- sql deque
- Hibernate中的Query cache(查询缓存)
- padding margin;gravity,layout_gravity
- 谈 UIView Animation 编程艺术