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];

你可能感兴趣的:(AFN请求问题)