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

posted @ 2016-03-16 11:00  i个O人S发  阅读(208)  评论(0编辑  收藏  举报