Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptabl

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

这里分享一下爬坑经历,忘读者不能速爬坑!

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

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

AFURLResponseSerialization.m中修改代码就能解决:

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

修改为

self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
上一篇:Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable con


下一篇:iOS之AFN错误代码1016(Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable)