AFN请求问题

在使用AFNetworking 2.0  的时候本来一切很顺畅,但是中途遇到几个比较坑的地方

在发送请求后,NSURLSessionDataTask一直报错

Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html"  

解决方法:

修改AFURLResponseSerialization.m文件的223行修改为以下:

self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/plain",@"text/html", nil];

github: https://github.com/ios-study 简书地址:https://www.jianshu.com/u/9d0a57d9905c
原文地址:https://www.cnblogs.com/xuhuizhan520/p/5282614.html