AFNetworking遇到错误 Request failed: unacceptable content-type: text/html

iOS 使用AFNetworking遇到错误 Request failed: unacceptable content-type: text/html
原因:
不可接受的内容类型 “text/html”
解决方案:
AFJSONResponseSerializer.m中,222行左右
把 这句: self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];
修改为:
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
在进行网络请求时出现-1016 是因为只支持
text/json,application/json,text/javascript
你可以添加text/html
一劳永逸的方法是 在
AFURLResponseSerialization.h
里面搜索
self.acceptableContentTypes
然后 在里面 添加
@"text/html",@"text/plain"
原文地址:https://www.cnblogs.com/duzhaoquan/p/8567497.html