AF请求数据失败,提示Request failed: unacceptable content-type: text/html

来源:互联网 发布:js控制svg 编辑:程序博客网 时间:2024/06/05 15:20
今天使用AFNetworking,url和param都正确的,但是有的接口获取不到数据,后来查看了error的返回错误Request failed: unacceptable content-type: text/html ,网上查询一下,意思是af不支持返回类型text/html,需要在为manager对象添加这么一句

manager.responseSerializer.acceptableContentTypes = [NSSetsetWithObject:@"text/html"];

添加之后完美解决。

0 0