首页 > 其他 > 详细

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

时间:2016-01-20 22:29:02      阅读:2423      评论:0      收藏:0      [点我收藏+]

在使用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: unacceptabl

原文:http://www.cnblogs.com/asheng/p/5146771.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!