在使用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];

 

相关文章:

  • 2022-12-23
  • 2021-09-26
  • 2021-08-31
  • 2022-01-23
  • 2021-11-29
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
猜你喜欢
  • 2021-06-07
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案