美文网首页
使用AFNetworking遇到异常 一直失败

使用AFNetworking遇到异常 一直失败

作者: O_Ozz | 来源:发表于2019-04-25 10:27 被阅读0次

最近使用AFNetworking Post请求一直失败,整了一下午,打断点看error也没什么,直到打印才知道是

Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7f999be478d0> { URL: myUrlXXXXXX } { status code: 200, headers {

明显可以看出content-type格式不符合啊!加入manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil]; 成功获取到结果,所以一定要看打印!

相关文章

网友评论

      本文标题:使用AFNetworking遇到异常 一直失败

      本文链接:https://www.haomeiwen.com/subject/vqragqtx.html